
Node Details
- Name:
multiRetrievalQAChain
- Type:
MultiRetrievalQAChain
- Category: [[Chains]]
- Version: 2.0
Parameters
-
Language Model (Required)
- Type: BaseLanguageModel
- Description: The language model used for generating responses and selecting retrievers.
-
Vector Store Retriever (Required)
- Type: VectorStoreRetriever
- Description: An array of vector store retrievers, each containing a vector store, name, and description.
- List: true
-
Return Source Documents (Optional)
- Type: boolean
- Description: Whether to return the source documents used to generate the answer.
-
Input Moderation (Optional)
- Type: Moderation[]
- Description: Moderation tools to detect and prevent harmful input.
- List: true
Input
- A string containing the userβs question or query.
Output
- If
Return Source Documents
is false:- A string containing the answer to the userβs question.
- If
Return Source Documents
is true:- An object containing:
text
: The answer to the userβs question.sourceDocuments
: An array of documents used to generate the answer.
- An object containing:
How It Works
- The chain receives a user question.
- If input moderation is enabled, it checks the input for potential harmful content.
- The language model analyzes the question to determine which vector store retriever is most appropriate.
- The selected retriever fetches relevant documents from its associated vector store.
- The language model generates an answer based on the retrieved documents and the original question.
- The answer (and optionally source documents) is returned as output.
Use Cases
- Creating versatile question-answering systems that can handle queries across multiple domains
- Building AI assistants capable of accessing and utilizing multiple specialized knowledge bases
- Implementing dynamic information retrieval systems for large, diverse document collections
- Developing research tools that can automatically select and search appropriate databases
- Creating flexible customer support systems that can answer questions from various product or service areas
Special Features
- Dynamic Retriever Selection: Automatically chooses the most appropriate vector store retriever for each query.
- Multiple Knowledge Base Support: Can handle questions across various topics or domains using specialized retrievers.
- Flexible Configuration: Allows for easy addition or modification of vector store retrievers.
- Input Moderation: Optional safeguards against inappropriate or harmful inputs.
- Source Attribution: Option to return source documents for transparency and verification.
- Improved Accuracy: By using specialized retrievers, it can provide more accurate and relevant answers.
Notes
- The effectiveness of the chain depends on the quality and diversity of the provided vector store retrievers.
- Careful design of retriever descriptions is crucial for accurate selection.
- The chain may require more computation time compared to single-retriever chains due to the selection process.
- Itβs important to ensure that the language model is capable of accurately selecting between retrievers.
- For best results, vector store retrievers should cover distinct knowledge domains or document types.
- Regular analysis of chain performance can help identify areas where new retrievers might be needed.
- The chain supports streaming responses for real-time interaction in compatible environments.