Skip to main content
The Knowledge Base gives your agent access to a collection of documents. When a user asks a question, the agent retrieves the most relevant passages and uses them to construct an accurate, grounded answer. This technique is called RAG — Retrieval-Augmented Generation.

Prerequisites

None — embeddings are handled automatically by the Alquimia runtime. Just open the Knowledge Base step and start uploading.

Uploading documents

Drag and drop files into the upload area or click to browse. Uploaded documents are:
  1. Processed and chunked into passages
  2. Embedded by the runtime engine
  3. Stored in the vector database (Qdrant)

Retrieval parameters

These parameters control how the agent searches your documents when answering a question.

Search type

TypeDescriptionBest for
similarityPure semantic similarity — finds the most relevant chunksSpecific, focused questions
mmrMaximal Marginal Relevance — balances relevance with diversityBroad questions, avoiding repetitive passages

Parameters

ParameterDefaultDescription
K4Number of document chunks retrieved per query
Score ThresholdnoneMinimum similarity score (0.0–1.0). Chunks below this are excluded.
Fetch KMMR only: candidates to evaluate before selecting the final K
Lambda MultMMR only: diversity weight (0 = max diversity, 1 = max relevance)
Start with similarity, K=4, and no threshold. Run a few test queries in the Test Drawer. If answers are repetitive, switch to mmr. If answers include irrelevant content, add a score threshold (try 0.7 first).

How retrieval works at runtime

When the agent receives a message:
  1. The query is embedded by the runtime using the same model that indexed the documents
  2. The vector database finds the K most similar document chunks
  3. Those chunks are injected into the agent’s prompt as context
  4. The LLM uses this context to generate a grounded answer
The agent cites information from your documents rather than relying solely on what the LLM learned during training.

Next steps

Memory

Add conversation memory alongside document retrieval.

Model Selection

Choose the LLM that generates grounded answers from retrieved context.