Test RAG and hallucinations
Generate questions from your documents to test your RAG application for hallucinations, answer relevance, and context retrieval efficiency
Get your Maihem API key and install the SDK before you start.
Create target agent (if you haven't already)
Add documents to generate questions from them
Maihem supports documents in the following formats: pdf, txt, docx, md.
Move all the documents to the same folder.
Create a test
Create a RAG test by using the RAG module
. A module defines the scope of a test.
A RAG test will generate a random set of questions from your documents to test your target agent, and evaluate these metrics:
- Answer relevance
- Context retrieval efficiency
- Hallucinations
See more detailed documentation on metrics and modules.
Connect target agent with wrapper function
Modify the following function to wrap your target agent:
Run the test
A test run
will generate:
- Simulated conversations between your target agent and Maihem
- Evaluations of the conversations
- A list of detected failures
See test run results
See the results in your Maihem account.
Or get the test results:
test_run_results
contains the following information: