Redis Vector Store

Node Details

  • Name: Redis_VectorStores
  • Type: Redis
  • Version: 1.0
  • Category: Vector Stores

Base Classes

  • Redis
  • VectorStoreRetriever
  • BaseRetriever

Parameters

Credential (Required)

  • Label: Connect Credential
  • Name: credential
  • Type: credential
  • Credential Names: redisCacheUrlApi, redisCacheApi

Inputs

  1. Document (Optional)
    • Type: Document
    • List: true
    • Description: The documents to be inserted into the vector store.
  2. Embeddings (Required)
    • Type: Embeddings
    • Description: The embedding model to use for converting documents into vectors.
  3. Index Name (Required)
    • Type: string
    • Placeholder: VECTOR_INDEX_NAME
    • Description: The name of the Redis index to use.
  4. Replace Index on Upsert (Optional)
    • Type: boolean
    • Default: false
    • Description: If true, deletes the existing index and recreates a new one when upserting.
  5. Content Field (Optional)
    • Type: string
    • Default: “content”
    • Description: Name of the field that contains the actual content.
  6. Metadata Field (Optional)
    • Type: string
    • Default: “metadata”
    • Description: Name of the field that contains the metadata of the document.
  7. Vector Field (Optional)
    • Type: string
    • Default: “content_vector”
    • Description: Name of the field that contains the vector.
  8. Top K (Optional)
    • Type: number
    • Default: 4
    • Description: Number of top results to fetch.

Outputs

  1. Redis Retriever
    • Name: retriever
    • Base Classes: [Redis, VectorStoreRetriever, BaseRetriever]
  2. Redis Vector Store
    • Name: vectorStore
    • Base Classes: [Redis, RedisVectorStore base classes]

Functionality

The node provides two main functionalities:
  1. Upsert: Allows inserting or updating documents in the Redis vector store.
  2. Similarity Search: Enables performing similarity searches on the stored vectors.

Usage

This node is typically used in workflows where fast similarity search is required on a large number of embedded documents. It’s particularly useful in applications such as:
  • Semantic search engines
  • Recommendation systems
  • Document retrieval systems
  • Any application requiring quick similarity comparisons between vectors

Implementation Details

  • The node uses the redis npm package for Redis client operations.
  • It implements a singleton pattern for the Redis client to optimize connections.
  • The node handles both direct Redis URL connections and credential-based connections.
  • It includes methods for upserting documents and performing similarity searches.
  • The implementation includes error handling and index existence checks.

Note

Ensure that you are running a RediSearch-capable Redis instance for full functionality of this node.