Node Details

  • Name: vectorStoreToDocument
  • Type: Document
  • Version: 2.0
  • Category: Document Loaders

Input Parameters

  1. Vector Store (required)

    • Type: VectorStore
    • Description: The vector store to search documents from
  2. Query (optional)

    • Type: string
    • Description: Query to retrieve documents from the vector database. If not specified, the user question will be used
    • Accepts variables
  3. Minimum Score (%) (optional)

    • Type: number
    • Description: Minimum score for embedding documents to be included
    • Placeholder: 75
    • Step: 1

Outputs

  1. Document

    • Description: Array of document objects containing metadata and pageContent
    • Base Classes: Document, json
  2. Text

    • Description: Concatenated string from pageContent of documents
    • Base Classes: string, json

Functionality

  1. The node takes a vector store, an optional query, and an optional minimum score as inputs.
  2. It performs a similarity search on the vector store using the provided query or input string.
  3. The search returns documents with their similarity scores.
  4. 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.