Retrieval Tool Assertions
In RAG applications, the model determines when to trigger retrieval. When an inquiry contains specific entities, the search query should include them. Useturn.calledTool with toolMatch and jsonMatch to verify retrieval tool execution:
.exactly(1) to ensure the retrieval is executed only once.
Checking Citations and Deterministic Facts
Knowledge base assistants often require citations or document tags in responses. Use deterministic matchers for these requirements:Verifying Grounding and Preventing Hallucinations
Hallucination is the primary risk in RAG applications. UsedefineJudge to create a Judge model that evaluates whether the answer is strictly supported by the retrieved context: