Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

RAG.INGEST

Last updated
RAG.INGEST pipeline doc_id text [META key value [key value ...]] [VECTORS vector [vector ...]]
Group
RAG
Complexity
O(N) where N is the length of the text
Arity
-4 (at least 4 words, counting the command name)
Flags
write, slow
Keys
first 1, last 1, step 1
HotKV Cloud
Performance and Scale
On-Premise
requires the rag-pipeline license feature

A RAG pipeline splits your documents into chunks, keeps each chunk with the embedding you computed for it, and answers searches that combine keyword (BM25) relevance with vector similarity, all inside HotKV. RAG.INGEST splits text with the pipeline’s chunking strategy and stores the chunks under doc_id. Ingesting a doc_id that already exists replaces all of its previous chunks.

Each chunk gets the id doc_id:n, where n counts from 0 in text order. To find out how a document will be chunked, ingest it once without vectors and read the reply (the chunk count), then compute one embedding per chunk and ingest it again with VECTORS.

Option Effect
META key value ... Metadata pairs copied onto every chunk of the document. RAG.SEARCH returns them and can filter on them.
VECTORS vector ... One embedding per chunk, in chunk order. Each embedding is a single argument of comma-separated numbers (0.12,0.98,0.44) with the pipeline’s dimensions. The number of embeddings must equal the number of chunks.

Without VECTORS, the chunks are found only by keyword search.

Case RESP2 RESP3
Document ingested Integer: the number of chunks stored (0 for empty text) Same

Errors:

  • ERR pipeline not found, or vector count or dimensions mismatch if the pipeline does not exist, the number of embeddings differs from the number of chunks, or an embedding has the wrong number of values.
  • ERR wrong number of arguments for 'rag.ingest' command if the argument count is wrong.
  • NOLICENSE rag-pipeline requires a HotKV license. Contact sales@hotkv.com if your license does not include the rag-pipeline feature.
127.0.0.1:6379> RAG.INGEST faq doc:1 "To reset your password, click Forgot password on the login screen.\n\nBilling questions go to the billing team." META source help-center VECTORS 0.9,0.1,0.0 0.0,0.2,0.9
(integer) 2
127.0.0.1:6379> RAG.INGEST faq doc:2 "Two-factor codes expire after 30 seconds." VECTORS 0.1,0.1
(error) ERR pipeline not found, or vector count or dimensions mismatch

The first call uses a paragraph pipeline, so the blank line in the text produces two chunks, doc:1:0 and doc:1:1.

HotKV-only command. Redis and Valkey have no equivalent.

RAG.CREATE, RAG.SEARCH, RAG.STATS, RAG.DROP, RAG.LIST, AI features guide