BXUP Track progress & test yourself — free
Forward Deployed AI Engineer · Hands-on lab · ~1 min read
FORWARD DEPLOYED AI ENGINEER · HANDS-ON LAB

Lab 04 · Continuous Evaluation Gate in CI/CD with Ragas & DeepEval

Construct an automated CI/CD evaluation harness using DeepEval that tests prompt modifications against a 50-question golden evaluation dataset and automatically fails pull request builds if Faithfulness drops below 0.90.

Time & Tier

~120 minutes hands-on · FDE Track, Core Production difficulty.

The Scenario

Engineering teams frequently push prompt changes that improve one use case while silently regressing five others. You will build an automated evaluation harness integrated with pytest and GitHub Actions that runs on every pull request, enforcing non-negotiable quality SLAs before code reaches staging.

Deliverables

  1. golden_dataset.json: 50 ground truth question-context-answer triplets.
  2. test_ci_evals.py: Pytest evaluation harness running DeepEval metrics.
  3. .github/workflows/ai-evals.yml: Automated GitHub Actions pipeline.

Step-by-Step Instructions

  1. Install Dependencies:

    pip install deepeval==1.2.0 pytest==8.3.2
    
  2. Define Test Cases: Load golden_dataset.json and map each entry to an LLMTestCase with input, actual_output, and retrieval_context.

  3. Configure the Evaluation Gate: In test_ci_evals.py:

    from deepeval import assert_test
    from deepeval.metrics import FaithfulnessMetric, AnswerRelevancyMetric
    
    def test_rag_slas(test_case):
        faithfulness = FaithfulnessMetric(threshold=0.90)
        relevance = AnswerRelevancyMetric(threshold=0.85)
        assert_test(test_case, [faithfulness, relevance])
    
  4. Verify It Works: Intentionally introduce a hallucinated sentence in a test case. Run pytest test_ci_evals.py and confirm that pytest terminates with an exit code of 1, blocking the pipeline.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in