Problem
The city government of Buenos Aires runs the WhatsApp assistant Boti, which handles more than 3 million conversations a month. Its website lists over 1,300 procedures, each with its own rules and exceptions. Many are close relatives, such as renewing and reprinting a driver's license. Standard RAG returns a mix of chunks from several procedures, so the model may answer about the wrong one, with wrong costs or requirements.
Example from the article: related procedures such as renewing and reprinting a driver's license are hard to tell apart.
Solution in brief
Instead of embedding raw document chunks, the team embeds one summary per procedure, extended with an LLM-written description of how it differs from its nearest neighbours. At query time an LLM re-reads the retrieved summaries only when the top two scores are close, and keeps the relevant ones. The agent then receives full procedure texts. A separate LLM classifier screens queries before the agent answers.
Questions this case answers
- How to retrieve the single correct document for a question when the collection holds many near-duplicate documents that differ only in details and standard embedding search mixes them up
- How to screen user queries for harmful content before an LLM agent answers, when off-the-shelf filters are not tuned to a specific language variant
- How to make a RAG assistant pick the right document when many documents are near-duplicates that differ in details?
- How to answer citizens' questions about hundreds of bureaucratic procedures without mixing up similar ones?
Tools and methods
- Comparative summaries — one summary per document plus a note on how it differs from similar documents; embedded for retrieval.
- Reasoning retriever — semantic search, optional LLM selection step, then lookup of full text.
- Amazon Bedrock — LLM inference (Converse API) and knowledge base.
- LangGraph — agent orchestration.
- Amazon DynamoDB — full procedure text and metadata.
- Claude (Haiku 3, Sonnet 3, 3.5 Sonnet) — LLM selection step.
- LLM input guardrail — custom classifier labelling queries approved or blocked.
Google or a one-time email code. No password.