"It looks good in my manual tests" is how enterprise AI projects get canceled. This module establishes the FDE evaluation discipline: constructing continuous CI/CD evaluation harnesses using Ragas and DeepEval, setting quantitative hallucination budgets, and preventing regression before code ever reaches a client.
A senior engineer opens a pull request: "Refactored system prompt to make customer service replies friendlier."
Two colleagues test 3 sample questions in the web playground. The answers sound cheerful and fluent. The PR is approved and merged to production.
Over the weekend, 400 customer queries fail. In making the prompt "friendlier," the model stopped enforcing strict loan policy exclusions and started promising interest rate waivers.
You cannot eyeball probabilistic systems. A 3-sentence prompt edit caused a silent 28% drop in policy compliance.
You implement an automated evaluation harness in GitHub Actions. Every future PR runs against a 150-question golden dataset and automatically fails the build if Faithfulness drops below 0.90.
In traditional software, tests are binary: assert response.status_code == 200.
In GenAI, the status code is always 200, even when the model generates toxic, hallucinated, or legally catastrophic output.
An FDE never evaluates an AI system by eyeballing ten random prompts. An FDE evaluates an AI system using quantitative benchmark harnesses integrated directly into the deployment pipeline:
[ Developer Opens Pull Request ]
│
▼
[ GitHub Actions CI Runner ]
│
▼
[ Golden Evaluation Dataset (150 Grounded QA Pairs) ]
│
├──► [ Component 1: Retrieval Eval ]
│ • Context Recall @ 5 >= 0.92
│ • Context Precision >= 0.88
│
└──► [ Component 2: Generation Eval ]
• Faithfulness / Groundedness >= 0.90
• Answer Relevance >= 0.85
• Hallucination Rate <= 0.05
│
▼
[ CI Automated Decision ]
│ │
(Passes SLAs) (Violates Thresholds)
│ │
▼ ▼
[ Allow Merge ] [ BLOCK MERGE & Alert PR ]
A production FDE decomposes evaluation into three independent, measurable vectors:
| Metric | Target SLA | What It Measures | How It Is Calculated |
|---|---|---|---|
| Context Recall | $\ge 0.90$ | Did retrieval find the facts needed to answer the question? | Proportion of ground truth claims present in retrieved context. |
| Faithfulness / Groundedness | $\ge 0.92$ | Does the answer stick strictly to retrieved context, or does it hallucinate? | Ratio of claims in generated answer that can be inferred from context. |
| Answer Relevance | $\ge 0.85$ | Does the answer directly address the user's specific prompt without wandering? | Semantic similarity of generated answer to the original question. |
Here is an enterprise evaluation harness that runs programmatically in CI:
# test_eval_harness.py - Production FDE CI/CD evaluation gate
import pytest
from deepeval import assert_test
from deepeval.test_case import LLMTestCase
from deepeval.metrics import FaithfulnessMetric, AnswerRelevancyMetric
# Define strict enterprise acceptance thresholds
faithfulness_metric = FaithfulnessMetric(threshold=0.90)
relevancy_metric = AnswerRelevancyMetric(threshold=0.85)
# Golden test dataset item
sample_test_case = LLMTestCase(
input="What is the claim filing window for vehicle accidents under Policy A-4?",
actual_output="Under Policy A-4, vehicle accident claims must be filed within 7 working days.",
retrieval_context=[
"Policy A-4 Section 3: All motor vehicle accidental damage claims must be formally submitted within 7 working days of the occurrence to be eligible for full reimbursement."
]
)
def test_rag_faithfulness_and_relevance():
"""
Executes automated evaluation; fails the pytest run if
faithfulness falls below 0.90 or relevance falls below 0.85.
"""
assert_test(sample_test_case, [faithfulness_metric, relevancy_metric])
When using an LLM to judge model outputs, an FDE must calibrate against three documented failure modes:
[A, B] and [B, A]) and aggregate.