Skip to main content
Node Details
-
Name: customRetriever
-
Type: CustomRetriever
-
Category: Retrievers
-
Version: 1.0
-
Base Classes: CustomRetriever, BaseRetriever
-
Vector Store (required)
-
Type: VectorStore
-
Description: The vector store to retrieve documents from.
-
Query (optional)
-
Type: string
-
Description: The query to retrieve documents. If not specified, the user’s question will be used.
-
Accepts variables: Yes
-
Result Format (required)
-
Type: string
-
Description: Format template for the returned results. Use
{{context}} to insert the document’s content and {{metadata.key}} to insert metadata values.
-
Default: “
{{context}}\nSource: {{metadata.source}}”
-
Top K (optional)
-
Type: number
-
Description: Number of top results to fetch. Defaults to the vector store’s topK value or 4 if not specified.
-
Default: 4
Outputs
-
Custom Retriever
-
Type: CustomRetriever
-
Description: The initialized custom retriever object.
-
Document
-
Type: Array of Document objects
-
Description: An array of document objects containing metadata and formatted page content.
-
Text
-
Type: string
-
Description: A concatenated string of the formatted page content from all retrieved documents.
Functionality
The Custom Retriever node enhances the standard vector store retrieval process by:
-
Allowing customization of the number of results to retrieve (topK).
-
Providing a flexible template system for formatting the retrieved results.
-
Enabling access to both document content and metadata in the output format.
-
Offering multiple output types (retriever object, document array, or concatenated text).
Usage
This node is particularly useful when you need to:
-
Customize the presentation of retrieved documents.
-
Include specific metadata fields in the output.
-
Control the number of results returned from the vector store.
-
Integrate retrieved information into a larger language model workflow with a consistent format.
Example
If you set the Result Format to: