Skip to content

RAG settings

Retrieval tuning

RAG settings control how much context the agent receives and how relevant that context must be. Too strict returns nothing; too broad adds noise.

Tune retrieval with real questions from callers, not abstract guesses.

Configure how your agent retrieves and uses knowledge base content.

Settings Reference

Setting Description Default Range
ragTopK Number of documents to retrieve 5 1-20
ragSimilarityThreshold Minimum similarity score (0-1) 0.70 0.0-1.0

Top K (ragTopK)

Controls how many document chunks are retrieved.

Value Behavior
1-3 Very focused, highest relevance only
5-10 (recommended) Good balance of relevance and coverage
10-20 Broad coverage, may include less relevant

Example

With ragTopK: 5, the system retrieves the 5 most similar document chunks.

Similarity Threshold (ragSimilarityThreshold)

Filters out less relevant matches.

Value Behavior
0.9+ Only very close matches (may return nothing)
0.7-0.9 (recommended) Good relevance filter
0.5-0.7 More permissive, includes broader matches
0.5- Very permissive, may include irrelevant content

Example

With ragSimilarityThreshold: 0.70, only documents with similarity ≥ 70% are included.

Finding the Right Balance

Too Strict (High threshold, low K)

  • Symptom: Agent doesn't use KB information
  • Fix: Lower threshold, increase K

Too Permissive (Low threshold, high K)

  • Symptom: Agent gets irrelevant or conflicting information
  • Fix: Raise threshold, decrease K
ragTopK: 5
ragSimilarityThreshold: 0.70

Adjust based on your specific use case and document quality.

Query Transformation

For better retrieval, enable query transformation (see Agent Options):

{
  "queryTransformEnabled": true,
  "queryTransformHistoryLimit": 5,
  "queryTransformConfidenceThreshold": 0.8
}

This analyzes conversation context to reformulate queries for better matching.