- Agentic RAG: Agent decides when to search the knowledge base
- Hybrid search: Combines vector similarity with keyword matching
- Reranking: Reorders results using a dedicated ranking model
Why Combine These Techniques
| Technique | What It Does |
|---|---|
| Agentic RAG | Agent searches only when needed, can reformulate queries |
| Hybrid search | Catches both semantic matches and exact terms |
| Reranking | Uses a dedicated model to reorder results by relevance |
How Reranking Works
After hybrid search returns initial results, the reranker:- Takes the query and candidate documents
- Scores each document for relevance using a cross-encoder model
- Reorders results so the most relevant appear first
rerank-v3.5 is trained specifically for this task and significantly improves result quality.
Example
agentic_rag.py