Quick Start
Retrieval Policies
Configuration
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
retrievalPolicy | RetrievalPolicy | AUTO | When to retrieve context |
topK | number | 5 | Number of results to retrieve |
hybrid | boolean | false | Use hybrid (keyword + semantic) search |
rerank | boolean | false | Rerank results for relevance |
includeCitations | boolean | true | Include source citations |
citationsMode | string | 'append' | How to show citations |
maxContextTokens | number | 4000 | Max context window |
autoMinLength | number | 10 | Min query length for AUTO |
Auto Keywords
Queries containing these keywords trigger retrieval in AUTO mode:Custom Keywords
Methods
shouldRetrieve
Check if a query should trigger retrieval:getConfig
Get the current configuration:Common Patterns
- With Knowledge Base
- With Agent
Best Practices
Use AUTO for general chatbots
Use AUTO for general chatbots
AUTO mode balances retrieval costs with response quality for most use cases.
Use ALWAYS for document Q&A
Use ALWAYS for document Q&A
When every query relates to documents, use ALWAYS to ensure context is included.
Enable reranking for accuracy
Enable reranking for accuracy
Reranking improves result relevance at a small latency cost.
Tune autoMinLength
Tune autoMinLength
Increase
autoMinLength to avoid retrieval for very short queries.
