Skip to main content
Retrieval is part of the Query workflow. It embeds a user query with input_type="query", searches the vector database, and returns the closest stored chunks. Use this page to understand the retrieval stage. Use the interface-specific pages when you need exact parameters, flags, request fields, or response shapes.
Retrieval does not generate an answer. It returns chunks and scores. Use Chat when you want answer generation over retrieved context.

Basic retrieval

Result:

Query embeddings

Retrieval uses the configured embedding model with input_type="query". This must match the model used during indexing, but not the input type.
Use the same embedding provider and model for indexing and retrieval. Document and query vectors from different models are not comparable.

Tuning knobs

Reranking

Reranking takes vector-search candidates and reorders them with a reranker. Retrieve wide, then rerank down.
Result:
Start with top_k=20 and rerank_top_k=5. The reranker needs enough candidates to improve ordering.

Query rewriting

Query rewriting turns a follow-up into a standalone search query before embedding. It needs an LLM.
Result:
The SDK can use a configured LLM for rewriting. REST exposes rewrite flags, but the server still needs a usable LLM provider configured.

Query pipeline

query() is the high-level query helper. It wraps embedding and retrieval settings in stable nested objects and returns the same RetrieveResult shape.
The CLI query command supports reranking, but it does not expose query rewrite flags yet. Use SDK or REST for query rewriting in the high-level query pipeline.

Possible errors

Interface validation errors raise immediately in SDK and REST. Core retrieval failures are returned in the result errors list when processing can continue. See Errors for the shared shapes.

Next steps

  • Use Chat to generate grounded answers from retrieved chunks.
  • Use Pipeline Overview to see how retrieval fits into the full RAG flow.
  • Use Vector Databases to verify provider names and collection settings.