Exercises

Solve 6 real-world chunking, retrieval, citation, and hallucination-prevention scenarios.

1. A refund policy ends Chunk 1 with 'Refunds allowed in 30 days' and starts Chunk 2 with 'except opened software'. Users get wrong answers. What fixes this?

2. KeywordIndex misses a customer asking 'terminate my plan' because your doc says 'cancel subscription'. What upgrade solves synonym mismatch?

3. When index.query(question) returns an empty list, what should your RAG wrapper do?

4. Your RAG app gets slow and expensive because it re-embeds 200 PDFs on every HTTP request. What is the fix?

5. Why should you require [DOC-x] citation tags in your RAG agent's reply and verify them in Python?

6. What does setting retrieval_threshold=0.7 and rerank=True in KnowledgeConfig accomplish?

Back to the RAG tutorial