Skip to main content
Retrieval embeds a user query, searches the vector database, and returns the closest chunks. Use rag.query() for the workflow-level API and rag.retrieve() when you want direct control over retrieval objects.

Workflow Retrieval: query()

query() returns query, search_query, retrieved, items, failed, and errors.

Direct Retrieval: retrieve()

Each retrieved item has id, chunk_id, score, text, metadata, and optional rerank_score.

Reranking

Retrieve more candidates than you show, then rerank down to the best few.
Or use the workflow config shape:

Query Rewriting

Query rewriting turns follow-up questions into standalone search queries. It requires an LLM.
Workflow config:

Parameters

Query

Use retrieval in the query workflow.

Chat

Generate answers from retrieved context.