Skip to main content
Tune top-k, similarity thresholds, and reranking so retrieval quality matches your use case.
The user submits a query; the agent pulls the best-matching passages before composing a reply.

Quick Start

1

Simple Usage

Retrieve the top matching passages with a similarity floor.
2

With Configuration

Switch to hybrid search to blend keyword and semantic scoring.

How It Works


Basic Retrieval

Retrieval Strategies

MMR (Maximal Marginal Relevance)

Query Enhancement

Use QueryRewriterAgent for better retrieval:

Best Practices

Use similarity for semantic questions, hybrid when exact keywords matter, and mmr when you need diverse rather than near-duplicate passages.
diversity=0.3 trades a little relevance for broader coverage. Raise it when top results repeat the same point.
QueryRewriterAgent reshapes short or ambiguous questions into retrieval-friendly form, improving recall without changing the user’s intent.
A high top_k with a low similarity_threshold floods the context; a low top_k with a high threshold can starve it. Adjust both when tuning quality.

Knowledge Module

Full API reference

QueryRewriterAgent

Query optimisation