What this thread does
Do first: Construct LLMTestCase from the actual interaction, then call the metric's measure(test_case).
Short answer
Single-turn cases hold the prompt and generated answer. A dataset is optional. Metrics produce a score from 0 to 1 and a reason.
What to do
| Item | Value / action |
|---|---|
| Case import | from deepeval.test_case import LLMTestCase |
| Case fields | input: prompt; actual_output: generated answer; retrieval_context: retrieved nodes for RAG |
| Metric import | from deepeval.metrics import AnswerRelevancyMetric |
| Score directly | Instantiate AnswerRelevancyMetric(), call measure(test_case), then read .score |
| Batch/script entry | from deepeval import evaluate; call evaluate(test_cases=[test_case], metrics=[answer_relevancy_metric]) |
| CLI route | Put assertions in test_example.py; use deepeval test run test_example.py, avoiding direct pytest execution |
| Assertion API | assert_test(test_case, metrics); optional run_async defaults to True for concurrent metric evaluation |
Limits and open questions
Every verdict-bearing metric must succeed. threshold=None records scores/reasons without a verdict; at least one non-flaky metric needs a threshold. With flaky=True, metric failures do not fail the case; a failing flaky case makes assert_test() warn. This page does not state the chosen metric's numeric default threshold.
Not for: ConversationalTestCase for multi-turn chatbots.
Sources
- DeepEval evaluation introduction, confident-ai.
Checked
2026-11-16; read DeepEval evaluation introduction; no command was run.
Started from a post by @Confident AI; trevor-cai; A-Vamshi, packaged by the editor. Original post