Retriever
Learn about retriever and how to implement it effectively.
Retriever (Agentflow Node)
The Retriever node in InnoSynth-Forjinn's Agentflow is a specialized component designed to fetch relevant information from your configured document stores (vector databases) based on a given query. This node is a cornerstone for implementing Retrieval Augmented Generation (RAG) patterns, allowing your AI to access and utilize external knowledge bases.
Purpose
The Retriever node is ideal for:
- Knowledge Retrieval: Fetching specific documents or chunks of information from a large corpus.
- Contextual Grounding: Providing relevant context to LLMs, enabling them to generate more accurate and informed responses.
- RAG Applications: Building AI applications that can answer questions based on your proprietary data.
- Dynamic Information Access: Allowing agents to dynamically search and retrieve information as needed during a conversation.
Appearance on Canvas
(Image: Placeholder for the Retriever node icon/appearance on the canvas)
Configuration Parameters
The Retriever node requires you to specify the document stores to query and the query itself.
1. Knowledge (Document Stores) (Required)
- Label: Knowledge (Document Stores)
- Type:
arrayof objects - Description: Select one or more document stores (vector databases) from which to retrieve information. These document stores must have been upserted (populated with data) in advance.
- Document Store: Choose an available document store.
2. Retriever Query (Required)
- Label: Retriever Query
- Type:
string - Placeholder:
Enter your query here - Description: The query or question that the retriever will use to search the selected document stores. This can be a static string or a dynamic value from a preceding node (e.g.,
{{userQuestion}}).
3. Output Format (Required)
- Label: Output Format
- Type:
options - Default:
text - Options:
Text,Text with Metadata - Description: Determines the format of the retrieved information in the node's output.
- Text: Returns only the textual content of the retrieved documents, concatenated.
- Text with Metadata: Returns a JSON string containing the full document objects, including their content and any associated metadata.
4. Update Flow State (Optional)
- Label: Update Flow State
- Type:
arrayof objects - Description: Allows you to update the runtime state of the workflow during the retriever's execution.
- Key: The key of the state variable to update.
- Value: The new value for the state variable. Supports variables and the output of the retriever (
{{ output }}).
Inputs & Outputs
- Input: Typically receives a query string or a trigger to initiate the retrieval process.
- Output: Produces the retrieved documents in the specified
Output Format. This output can then be passed to an LLM for summarization, question answering, or further processing.
Example Usage: Answering Questions from a Knowledge Base
Let's build a chatflow that answers user questions using a private knowledge base.
- Connect a
Startnode to the input of aRetrievernode. - Configure Knowledge (Document Stores): Select your pre-populated document store (e.g., "Company Policies Document Store").
- Configure Retriever Query: Set this to
{{question}}(assuming the user's query is passed asquestion). - Configure Output Format:
Text(to get just the relevant text). - Connect
Retrieveroutput to anLLMnode. - Configure
LLM:- Set a system message: "You are an assistant that answers questions based on the provided context. If the answer is not in the context, state that you don't know."
- Set the input to include the retrieved documents:
Context: {{output}}\nQuestion: {{question}}
- Connect
LLMoutput to aChat Outputnode.
Now, when a user asks a question, the Retriever node will fetch relevant information from your document store, and the LLM will use that information to formulate an answer.