BuildShip Logo
BuildShipΒ Community

RAG using BuildShip

This template enables you to easily create a powerful RAG system directly using BuildShip's database.

104

Report this template

Select the reason for reporting

Describe the issue in detail

Share template

Link to template

https://templates.buildship.com/template/43ER1RXdUv9h/

This template contains 2 flows:

Inputs

query

What does the guide say about wifi?

chunksCollectionName

fileChunks

embeddingFieldName

embedding
This is a static example using sample inputs. Remix the template to run it with your own values.

Output

Read me

πŸ“– Easy RAG with BuildShip

This template enables you to create a powerful RAG system directly using BuildShip's database. Compared to our RAG with Supabase template, it is much faster to set up, and you can complete the entire setup within BuildShip.

Main Features:

  • Smart PDF Processing: Automatically chunks and processes your PDF documents for optimal retrieval
  • AI-Powered Search: Powerful and fast similarity searchΒ 
  • Intelligent Responses: Generates contextual answers using GPT model

βœ… Prerequisites

✍️ How to Use

This template contains two workflows

  1. Store Vector Embeddings: Handles document, in this case PDF, upload, chunking and embedding generation using Open AI.
  2. RAG using BuildShip: Processes user queries using BuildShip's database Vector Query(nearest-neighbor query) node and generates contextual responses using Open AI Text Generator.

βš™οΈ 1. Setup: Store Vector Embeddings Template

This workflow processes your uploaded PDF by extracting text, chunking it, generating embeddings for each chunk, and storing them in your BuildShip database.

Step 1: Add Mistral AI API Key

Mistral AI OCR API is used to extract the text from uploaded PDFs.

Step 2: Add OpenAI API key

The Store Vector Embeddings node uses OpenAI to generate embeddings of the PDF text and stores it in your BuildShip database.

πŸ§ͺ Test Template

To test the workflow you must fill in the 4 required inputs:

  1. pdfFile - This is the PDF file used to generate vector embeddings. Click the upload button to select and upload a PDF from your device.
  2. filesCollectionName - This is where you specify the collection name for storing file metadata, including the filename, MIME type, size, download URL, etc.
  3. chunksCollectionName - This is the collection where the PDF chunks and their generated embeddings will be stored.
  4. embeddingFieldName: The name of the field in your chunks collection that should store the embedding. For this template, you can set this to content.

βœ… Now you're ready to test the workflow and start generating and storing your document embeddings. If all goes as expected you should a success message like the one below:

πŸš€ You're now ready to ship you workflow

βš™οΈ 2. Setup: RAG using BuildShip

This workflow allows you to perform semantic search on your uploaded PDF, extracting relevant information based on context. It then generates detailed, context-aware responses using GPT, enhancing the ability to interact with the content in a meaningful way.

Step 1: Generate Embeddings - Add OpenAI API key (Same as above)

Step 2: Text Generator - Add OpenAI API key (Same as above)

πŸ§ͺ Test Template

To test the workflow you must fill in the 3 required inputs:

  1. query - This is your search query.
  2. chunksCollectionName - This is the collection where the PDF chunks and their generated embeddings were stored. Use the same name used in the previous Store Vector Embeddings template.
  3. embeddingFieldName - The name of the field in your chunks collection that stores the embedding. Use the same name used in the previous Store Vector Embeddings template.

NOTE βœ‹: On the first test run you'll get an error thrown on the Vector Query node. Don't panic, this is expected. This is because a vector index is required so just click the create index button to create the index and wait a while for the index to finish creating.

If you try again too soon, you'll receive a different error message indicating that the index is still being built and is not yet available.

After waiting for a while and testing the workflow again, it should work, and you'll receive your response πŸŽ‰.

πŸš€ You're now ready to ship you workflow

πŸ”— Resources