节点与集成

Redis Vector Store

Use the Redis Vector Store node to interact with your Redis database as a vector store1. You can insert documents into the vector database, get documents from the vector database, retrieve documents using a retriever connected to a chain2, or connect it directly to an agent3 to use as a tool4.

On this page, you'll find the node parameters for the Redis Vector Store node, and links to more resources.

Prerequisites

Before using this node, you need a Redis database with the Redis Query Engine enabled. Use one of the following:

  • Redis Open Source (v8.0 and later) : includes the Redis Query Engine by default
  • **Redis Cloud** : fully managed service
  • **Redis Software** : self-managed deployment

Node usage patterns

You can use the Redis Vector Store node in the following patterns:

Use as a regular node to insert and retrieve documents

You can use the Redis Vector Store as a regular node to insert or get documents. This pattern places the Redis Vector Store in the regular connection flow without using an agent.

You can see an example in this template where the semantic cache is stored in Redis and retrieved using the Redis Vector Store node in the start of the workflow.

Connect directly to an AI agent as a tool

You can connect the Redis Vector Store node directly to the tool4 connector of an AI agent to use a vector store as a resource when answering queries.

Here, the connection would be: AI agent (tools connector) -> Redis Vector Store node.

Use a retriever to fetch documents

You can use the Vector Store Retriever node with the Redis Vector Store node to fetch documents from the Redis Vector Store node. This is often used with the Question and Answer Chain node to fetch documents from the vector store that match the given chat input.

An example of the connection flow (the linked example uses Pinecone, but the pattern is the same) would be: Question and Answer Chain (Retriever connector) -> Vector Store Retriever (Vector Store connector) -> Redis Vector Store.

Use the Vector Store Question Answer Tool to answer questions

Another pattern uses the Vector Store Question Answer Tool to summarize results and answer questions from the Redis Vector Store node. Rather than connecting the Redis Vector Store directly as a tool, this pattern uses a tool specifically designed to summarizes data in the vector store.

This template shows how to use the Vector Store Question Answer Tool with the Redis Vector Store node. The connections flow in this case would look like this: AI agent (tools connector) -> Vector Store Question Answer Tool (Vector Store connector) -> Redis Vector store.

Node parameters

This Vector Store node has four modes: Get Many, Insert Documents, Retrieve Documents (As Vector Store for Chain/Tool), and Retrieve Documents (As Tool for AI Agent). The mode you select determines the operations you can perform with the node and what inputs and outputs are available.

Rerank Results

Enables reranking. If you enable this option, you must connect a reranking node to the vector store. That node will then rerank the results for queries. You can use this option with the Get Many, Retrieve Documents (As Vector Store for Chain/Tool) and Retrieve Documents (As Tool for AI Agent) modes.

Get Many parameters

  • Redis Index: Enter the name of the Redis vector search index to use. Optionally choose an existing one from the list.
  • Prompt: Enter the search query.
  • Limit: Enter how many results to retrieve from the vector store. For example, set this to 10 to get the ten best results.

This Operation Mode includes one Node option, the Metadata Filter.

Insert Documents parameters

  • Redis Index: Enter the name of the Redis vector search index to use. Optionally choose an existing one from the list.

Retrieve Documents (As Vector Store for Chain/Tool) parameters

  • Redis Index: Enter the name of the Redis vector search index to use. Optionally choose an existing one from the list.

This Operation Mode includes one Node option, the Metadata Filter.

Retrieve Documents (As Tool for AI Agent) parameters

  • Name: The name of the vector store.
  • Description: Explain to the LLM what this tool does. A good, specific description allows LLMs to produce expected results more often.
  • Redis Index: Enter the name of the Redis vector search index to use. Optionally choose an existing one from the list.
  • Limit: Enter how many results to retrieve from the vector store. For example, set this to 10 to get the ten best results.

Include Metadata

Whether to include document metadata.

You can use this with the Get Many and Retrieve Documents (As Tool for AI Agent) modes.

Node options

Metadata Filter

Metadata filters are available for the Get Many, Retrieve Documents (As Vector Store for Chain/Tool), and Retrieve Documents (As Tool for AI Agent) operation modes. This is an OR query. If you specify more than one metadata filter field, at least one of them must match. When inserting data, the metadata is set using the document loader. Refer to Default Data Loader for more information on loading documents.

Redis Configuration Options

Available for all operation modes:

  • Metadata Key: Enter the key for the metadata field in the Redis hash (default: metadata).
  • Key Prefix: Enter the key prefix for storing documents (default: doc:).
  • Content Key: Enter the key for the content field in the Redis hash (default: content).
  • Embedding Key: Enter the key for the embedding field in the Redis hash (default: embedding).

Insert Options

Available for the Insert Documents operation mode:

  • Overwrite Documents: Select whether to overwrite existing documents (turned on) or not (turned off). Also deletes the index.
  • Time-to-Live: Enter the time-to-live for documents in seconds. Does not expire the index.

Templates and examples

Browse Redis Vector Store node documentation integration templates or search all templates

Related resources

Refer to:

View n8n's Advanced AI documentation.

New to working with AI and using self-hosted n8n? Try n8n's self-hosted AI Starter Kit to get started with a proof-of-concept or demo playground using Ollama, Qdrant, and PostgreSQL.

Footnotes

  1. A vector store, or vector database, stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.

    Back
  2. AI chains allow you to interact with large language models (LLMs) and other resources in sequences of calls to components. AI chains in n8n don't use persistent memory, so you can't use them to reference previous context (use AI agents for this).

    Back
  3. AI agents are artificial intelligence systems capable of responding to requests, making decisions, and performing real-world tasks for users. They use large language models (LLMs) to interpret user input and make decisions about how to best process requests using the information and resources they have available.

    Back
  4. In an AI context, a tool is an add-on resource that the AI can refer to for specific information or functionality when responding to a request. The AI model can use a tool to interact with external systems or complete specific, focused tasks.

    Back

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明