Flowise RAG CHATFLOW COMPONENTS
In this guide, we will walk you through the process of creating an AI assistant chatflow in Flowise. This chatflow is designed to answer questions based on documents loaded into Pinecone, using various components integrated within Flowise.
Below is a step-by-step description of the setup, including the role and configuration of each block.
1. Recursive Character Text Splitter
Purpose: The Recursive Character Text Splitter block is used to divide large documents into smaller chunks. This is essential for efficient processing and embedding generation.
Configuration:
- Chunk Size: 500 characters
- Chunk Overlap: 50 characters
- Additional Parameters: Default settings
The text splitter ensures that the text is broken down into manageable pieces, allowing for more accurate embeddings and retrievals later in the process.
2. Cheerio Web Scraper
Purpose: The Cheerio Web Scraper extracts content from a specified URL. This is particularly useful for dynamically fetching content from web pages.
Configuration:
- URL: The URL of the document you want to scrape (e.g.,
https://ainsider.notion.site/Ainsider-io
) - Text Splitter: Connects to the output of the Recursive Character Text Splitter
This block ensures that content from the specified web page is fetched and prepared for further processing.
3. Pinecone
Purpose: Pinecone is a vector database used to store and retrieve high-dimensional data, such as text embeddings.
Configuration:
- Document: Connects to the output of the Cheerio Web Scraper
- Embeddings: Takes embeddings generated from the OpenAI Embeddings block
- Record Manager: Default settings
- Pinecone Index: Specify the index (e.g.,
flowise.ainsiderbot
)
Pinecone stores the document embeddings, allowing for efficient retrieval based on similarity searches.
4. OpenAI Embeddings
Purpose: This block generates embeddings for the chunks of text created by the text splitter.
Configuration:
- Connect Credential: Credential for FlowiseHuggingface1 (set up your OpenAI API key)
- Model Name:
text-embedding-ada-002
Embeddings are vector representations of the text chunks, which capture semantic meaning and are used for similarity matching in Pinecone.
5. Chat OpenAI
Purpose: This block serves as the interface for OpenAI’s chat model, which will generate responses based on user queries.
Configuration:
- Cache: Optional caching settings
- Connect Credential: Credential for FlowiseHuggingface1
- Model Name:
gpt-3.5-turbo
- Temperature: 0.4 (controls the randomness of the output)
The ChatOpenAI block is responsible for formulating responses using the GPT-3.5-turbo model, guided by the context retrieved from Pinecone.
6. Conversational Retrieval QA Chain
Purpose: The Conversational Retrieval QA Chain integrates all components to provide a final answer based on retrieved documents.
Configuration:
- Chat Model: Connects to the output of the ChatOpenAI block
- Vector Store Retriever: Connects to the output of the Pinecone Retriever
- Memory: Optional memory settings
- Input Moderation: Optional moderation settings
- Return Source Documents: Ensure this is enabled to provide context in responses
This block ties together the chat model and the vector store, ensuring that responses are grounded in the content of the documents stored in Pinecone.
Summary
This chatflow setup in Flowise allows you to create an AI assistant capable of answering questions based solely on a predefined set of documents. By breaking down the document into smaller chunks, generating embeddings, storing them in Pinecone, and leveraging OpenAI’s GPT model for responses, you ensure accurate and contextually relevant answers.
Each block in this flow has a specific role, contributing to the overall functionality of the AI assistant. By following the configurations and connections as described, you can replicate this setup and adapt it to your own documents and use cases.