Document loaders
VectorStore To Document
The VectorStore To Document node is a component in the Document Loaders category that allows you to search and retrieve documents with scores from a vector store. It converts the retrieved documents into either a document object array or a concatenated text string.
Node Details
- Name: vectorStoreToDocument
- Type: Document
- Version: 2.0
- Category: Document Loaders
Input Parameters
-
Vector Store (required)
- Type: VectorStore
- Description: The vector store to search documents from
-
Query (optional)
- Type: string
- Description: Query to retrieve documents from the vector database. If not specified, the user question will be used
- Accepts variables
-
Minimum Score (%) (optional)
- Type: number
- Description: Minimum score for embedding documents to be included
- Placeholder: 75
- Step: 1
Outputs
-
Document
- Description: Array of document objects containing metadata and pageContent
- Base Classes: Document, json
-
Text
- Description: Concatenated string from pageContent of documents
- Base Classes: string, json
Functionality
- The node takes a vector store, an optional query, and an optional minimum score as inputs.
- It performs a similarity search on the vector store using the provided query or input string.
- The search returns documents with their similarity scores.
- Depending on the chosen output type (document or text):
- For ‘document’ output: It filters the documents based on the minimum score (if provided) and returns an array of document objects.
- For ‘text’ output: It filters the documents based on the minimum score (if provided), concatenates the page content of the filtered documents, and returns a single string.
Use Cases
- Retrieving relevant documents from a vector database based on a user query
- Filtering and processing search results from a vector store
- Converting vector store search results into a format suitable for further processing or display
Notes
- The node uses the
similaritySearchWithScore
method of the vector store, which returns both documents and their similarity scores. - The minimum score parameter allows for filtering out less relevant documents.
- The node handles escape characters in the output text to ensure proper formatting.
- Console logging is implemented for debugging purposes, showing the raw search results.
Example Usage
This node can be used in workflows where you need to retrieve relevant documents from a vector store based on a query, such as in question-answering systems, document retrieval tasks, or as part of a larger information retrieval pipeline.
Was this page helpful?