Skip to contentমূল লেখায় যান

Topic 29 · AI/ML testingটপিক 29 · AI/ML testing

RAG Test Automation at Scale: Synthetic Data and Regression

A knowledge base update is a deploy with no diff. The only way to know what it broke is to run the same questions through it, automatically, every time.

6 min read6 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 5 sources5টি সোর্স · updated Nov 2026আপডেট: Nov 2026

A knowledge base update hits the gateএকটা knowledge base আপডেট গেটে আটকায়

Change one document and watch generated scenarios run and block the deploy on a failure.একটা ডকুমেন্ট বদলান আর দেখুন তৈরি করা সিনারিও চলে এবং একটা ব্যর্থতায় ডেপ্লয় আটকে যায়।

2 min2 মিনিট7 steps7টি ধাপ
  • Scenariosসিনারিও0
  • Gateগেট–
Knowledgeনলেজbaseবেস1 document changed1টি ডকুমেন্ট বদলেছেQualityকোয়ালিটিscanস্ক্যানRAGRAGappঅ্যাপLLMLLMjudgeজাজGateগেটwaitingঅপেক্ষা

You’ll learnআপনি শিখবেন

  • Why a knowledge base update needs a test runknowledge base আপডেটে কেন টেস্ট চালাতে হয়✓
  • How the scan tags scenarios llm, retrieval, historyস্ক্যান কীভাবে সিনারিওতে ট্যাগ বসায়
  • What a tag does and does not proveএকটা ট্যাগ কী প্রমাণ করে, কী করে না
  • The gate: any failure blocks the deployগেট: একটা ব্যর্থতাই ডেপ্লয় আটকায়
  • Why a stale hand-written set misses the changeপুরনো হাতে-লেখা সেট কেন পরিবর্তন ধরে না

In plain words

A hand-written RAG eval set of 20 or 50 questions covers what a tester thought to ask. Giskard's quality scan generates test scenarios automatically from the knowledge base itself, at a scale no one would write by hand. The scenarios include:

  • Direct questions grounded in a document
  • Multi-topic and history-dependent questions
  • Sycophancy probes
  • Out-of-scope questions the documents never cover

The scan is the Giskard v3 successor of the v2 RAGET tool Source 2সোর্স 2. Each scenario is tagged with the component it is meant to assess (llm, retrieval, or history) Source 1সোর্স 1.

A new problem. Automatic generation solves a coverage problem, but it creates a new one. A knowledge base changes constantly (a policy is updated, a document is added or removed), and a test set generated once goes stale.

Regression as a gate. The fix is to treat the knowledge base like code. Every update runs the regression suite, judged by the scan's LLM judge (you can add Ragas faithfulness and context metrics, as used elsewhere in the course, for a second opinion Source 3সোর্স 3). A failing scenario blocks the update from going live. The tutorial enforces this as a step in a CI workflow Source 4সোর্স 4; the gate design itself is the tutorial's own view.

সহজ English

A hand-written test set of 20 or 50 questions covers only what a tester thought to ask. Giskard's quality scan builds test scenarios by itself from the knowledge base. It makes far more than anyone would write by hand.

The scenarios include these kinds of questions:

  • Direct questions based on one document.
  • Questions that mix several topics, or depend on chat history.
  • Sycophancy probes.
  • Out-of-scope questions, which the documents never cover.

This is the Giskard v3 replacement for the v2 tool RAGET Source 2সোর্স 2. Each scenario is tagged with the part it is meant to test: llm, retrieval, or history Source 1সোর্স 1.

Auto-generation fixes the coverage problem, but it adds another one. A knowledge base keeps changing. A policy is updated, or a document is added or removed. A test set made once goes stale.

The fix is to treat the knowledge base like code. Every update runs the regression suite. The scan's LLM judge scores the answers. You can add Ragas faithfulness and context metrics for a second opinion Source 3সোর্স 3. If any scenario fails, the update does not go live. A step in a CI workflow enforces this Source 4সোর্স 4. The gate design is the tutorial's own view.

বাংলা ব্যাখ্যা

একটা হাতে-লেখা RAG eval সেট ২০ বা ৫০টা প্রশ্ন, যা একজন টেস্টার জিজ্ঞেস করার কথা ভেবেছিল তা কভার করে। Giskard-এর quality scan স্বয়ংক্রিয়ভাবে knowledge base থেকেই test scenario তৈরি করে, এমন স্কেলে যা কেউ হাতে লিখবে না: document-ভিত্তিক সরাসরি প্রশ্ন, একাধিক topic বা কথোপকথনের ইতিহাস-নির্ভর প্রশ্ন, sycophancy probe, আর document-এ নেই এমন out-of-scope প্রশ্ন। এটা v2-এর RAGET tool-এর Giskard v3 উত্তরসূরি Source 2সোর্স 2, আর প্রতিটা scenario ট্যাগ করা থাকে কোন component যাচাই করার জন্য (llm, retrieval, বা history) Source 1সোর্স 1।

স্বয়ংক্রিয় generation একটা coverage সমস্যা সমাধান করে, কিন্তু একটা নতুন তৈরি করে: একটা knowledge base ক্রমাগত বদলায় (একটা policy update হয়, একটা document যোগ বা সরানো হয়), আর একবার তৈরি করা একটা test set পুরনো হয়ে যায়। সমাধান হলো knowledge base-কে code-এর মতো দেখা: প্রতিটা update regression suite চালায়, scan-এর LLM judge দিয়ে বিচার করা (দ্বিতীয় মতামতের জন্য course-এর অন্য জায়গায় ব্যবহৃত Ragas faithfulness আর context metric যোগ করতে পারেন Source 3সোর্স 3), আর একটা ব্যর্থ scenario update-কে live হতে বাধা দেয়, CI workflow-এর একটা ধাপ হিসেবে প্রয়োগ করা Source 4সোর্স 4; gate-এর এই নকশা টিউটোরিয়ালের নিজস্ব মত।

How it works

The pipeline runs on every knowledge base change, not on a developer's schedule:

1. knowledge base updates      a document is added, changed, or removed
2. quality_scan generates        scenarios (max_scenarios is a total budget split across generators), component-tagged, from the new KB
3. the RAG pipeline answers      every generated question, through the real app
4. the scan's LLM judge scores    each answer pass or fail, grouped by component
5. compare to the threshold      if any scenario failed, block; if none, deploy

Source 1সোর্স 1 The scan's component tags matter for step 5: a failure tagged retrieval points somewhere different than one tagged llm or history. The tags describe what a scenario is designed to assess; they do not prove which internal component caused a failure, so use them to find patterns and then read the trace Source 1সোর্স 1.

In the tutorial's own view, the gate is the same shape as any other CI quality gate: a threshold on a score, wired to a pipeline step that can fail a build. What is specific to RAG here is only what feeds the threshold — a scan generated from the current knowledge base instead of a fixed question list.

সহজ English

The pipeline runs on every knowledge base change. It does not wait for a developer's schedule.

1. knowledge base updates      a document is added, changed, or removed
2. quality_scan generates        scenarios (max_scenarios is a total budget split across generators), component-tagged, from the new KB
3. the RAG pipeline answers      every generated question, through the real app
4. the scan's LLM judge scores    each answer pass or fail, grouped by component
5. compare to the threshold      if any scenario failed, block; if none, deploy

Source 1সোর্স 1 The component tags matter in step 5. A failure tagged retrieval points to a different place than one tagged llm or history. But the tags only say what a scenario was designed to test. They do not prove which part caused a failure. Use them to spot patterns, then read the trace Source 1সোর্স 1.

In the tutorial's own view, the gate is the same as any other CI quality gate. It is a threshold on a score, tied to a pipeline step that can fail a build. Only the input is special to RAG. The scan is generated from the current knowledge base, not from a fixed list of questions.

বাংলা ব্যাখ্যা

pipeline প্রতিটা knowledge base পরিবর্তনে চলে, একজন developer-এর schedule-এ নয়:

1. knowledge base updates      a document is added, changed, or removed
2. quality_scan generates        scenarios (max_scenarios is a total budget split across generators), component-tagged, from the new KB
3. the RAG pipeline answers      every generated question, through the real app
4. the scan's LLM judge scores    each answer pass or fail, grouped by component
5. compare to the threshold      if any scenario failed, block; if none, deploy

Source 1সোর্স 1 ধাপ ৫-এর জন্য scan-এর component ট্যাগ গুরুত্বপূর্ণ: retrieval ট্যাগ করা ব্যর্থতা llm বা history ট্যাগ করা ব্যর্থতার চেয়ে আলাদা দিকে ইঙ্গিত করে। ট্যাগ বলে scenario-টা কী যাচাই করার জন্য বানানো, কোন ভেতরের component ব্যর্থতার কারণ তা প্রমাণ করে না, তাই pattern খুঁজতে ব্যবহার করুন, তারপর trace পড়ুন Source 1সোর্স 1।

টিউটোরিয়ালের নিজস্ব মতে, gate নিজেই অন্য যেকোনো CI quality gate-এর মতো আকার: একটা score-এ একটা threshold, একটা pipeline ধাপের সাথে জোড়া যা একটা build ব্যর্থ করতে পারে। এখানে RAG-এর জন্য নির্দিষ্ট শুধু threshold-কে কী খাওয়ায় — একটা স্থির-এর বদলে নতুনভাবে generate করা একটা প্রশ্ন সেট।

In practice

Generate the scenarios and run them against the app with Giskard's quality scan Source 1সোর্স 1:

from giskard.checks import set_default_generator
from giskard.scan import KnowledgeBase, quality_scan

# the scan needs a default LLM generator (and OPENAI_API_KEY in the environment)
set_default_generator("openai/gpt-4o-mini")

# support_agent is your wrapped app: async def support_agent(inputs: str) -> str
knowledge_base = KnowledgeBase.from_texts(faq_texts)  # a list of strings

async def run_scan():
    return await quality_scan(
        target=support_agent,
        description="A customer support chatbot answering from a return-policy knowledge base.",
        languages=["en"],
        knowledge_base=knowledge_base,
        max_scenarios=20,
        target_mode="singleturn",
    )

Gate the pipeline on the scan result Source 1সোর্স 1:

import pytest

@pytest.mark.asyncio
async def test_the_knowledge_base_update_does_not_regress():
    result = await run_scan()
    # result.recommendation is a lead for a human to read, not a verdict
    assert result.failed_count == 0, result.recommendation

Wire it to run on every knowledge base change, not on a code change, using a paths filter on the push trigger Source 5সোর্স 5:

# .github/workflows/kb-regression.yml
on:
  push:
    paths: ["knowledge_base/**"]
jobs:
  regression:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install "giskard[scan,openai]" pytest pytest-asyncio
      - run: python -m pytest tests/test_kb_regression.py
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Regenerate the question set on every run rather than reusing a stale one; a stale set tests the old knowledge base, not the new one.
  • Keep the per-component results (result.group_by("component")), not just the overall pass rate, in the test output.
  • Scope the trigger to the knowledge base's own path, so an unrelated code change does not spend minutes (and LLM API credits, since the scan calls an LLM to generate and to judge) for nothing.

সহজ English

First, generate the scenarios and run them against the app with Giskard's quality scan Source 1সোর্স 1:

from giskard.checks import set_default_generator
from giskard.scan import KnowledgeBase, quality_scan

# the scan needs a default LLM generator (and OPENAI_API_KEY in the environment)
set_default_generator("openai/gpt-4o-mini")

# support_agent is your wrapped app: async def support_agent(inputs: str) -> str
knowledge_base = KnowledgeBase.from_texts(faq_texts)  # a list of strings

async def run_scan():
    return await quality_scan(
        target=support_agent,
        description="A customer support chatbot answering from a return-policy knowledge base.",
        languages=["en"],
        knowledge_base=knowledge_base,
        max_scenarios=20,
        target_mode="singleturn",
    )

Next, make the pipeline fail when the scan result shows failures Source 1সোর্স 1. The result.recommendation text is a lead for a human to read. It is not a verdict.

import pytest

@pytest.mark.asyncio
async def test_the_knowledge_base_update_does_not_regress():
    result = await run_scan()
    # result.recommendation is a lead for a human to read, not a verdict
    assert result.failed_count == 0, result.recommendation

Last, run this test on every knowledge base change, not on a code change, using a paths filter on the push trigger Source 5সোর্স 5:

# .github/workflows/kb-regression.yml
on:
  push:
    paths: ["knowledge_base/**"]
jobs:
  regression:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install "giskard[scan,openai]" pytest pytest-asyncio
      - run: python -m pytest tests/test_kb_regression.py
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Tutorial advice. This advice is the tutorial's own. It does not come from the sources.

  • Make a new question set on every run. An old set tests the old knowledge base, not the new one.
  • Keep the results for each component in the test output (result.group_by("component")). Do not keep only the overall pass rate.
  • Limit the trigger to the knowledge base's own path. Then an unrelated code change does not waste minutes or LLM API credits. The scan calls an LLM to generate and to judge.

বাংলা ব্যাখ্যা

Giskard-এর quality scan দিয়ে scenario generate করে app-এর বিরুদ্ধে চালান Source 1সোর্স 1:

from giskard.checks import set_default_generator
from giskard.scan import KnowledgeBase, quality_scan

# the scan needs a default LLM generator (and OPENAI_API_KEY in the environment)
set_default_generator("openai/gpt-4o-mini")

# support_agent is your wrapped app: async def support_agent(inputs: str) -> str
knowledge_base = KnowledgeBase.from_texts(faq_texts)  # a list of strings

async def run_scan():
    return await quality_scan(
        target=support_agent,
        description="A customer support chatbot answering from a return-policy knowledge base.",
        languages=["en"],
        knowledge_base=knowledge_base,
        max_scenarios=20,
        target_mode="singleturn",
    )

scan-এর ফলাফলে pipeline gate করুন Source 1সোর্স 1:

import pytest

@pytest.mark.asyncio
async def test_the_knowledge_base_update_does_not_regress():
    result = await run_scan()
    # result.recommendation is a lead for a human to read, not a verdict
    assert result.failed_count == 0, result.recommendation

একটা code পরিবর্তনে নয়, প্রতিটা knowledge base পরিবর্তনে চালানোর জন্য push trigger-এর paths filter দিয়ে জোড়া দিন Source 5সোর্স 5:

# .github/workflows/kb-regression.yml
on:
  push:
    paths: ["knowledge_base/**"]
jobs:
  regression:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install "giskard[scan,openai]" pytest pytest-asyncio
      - run: python -m pytest tests/test_kb_regression.py
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • একটা পুরনো সেট আবার ব্যবহারের বদলে প্রতিটা run-এ প্রশ্ন সেট regenerate করুন; একটা পুরনো সেট পুরনো knowledge base টেস্ট করে, নতুনটা নয়।
  • test output-এ শুধু সার্বিক pass rate নয়, per-component ফলাফল (result.group_by("component")) রাখুন।
  • trigger-কে knowledge base-এর নিজস্ব path-এ সীমাবদ্ধ করুন, যাতে একটা অসম্পর্কিত code পরিবর্তন অকারণে মিনিট আর LLM API credit ব্যয় না করে (scan generate আর judge করতে LLM call করে)।

Common mistakes

Mistake 1: generating the test set once and reusing it forever. A regenerated set tests the current knowledge base; a stale one tests a knowledge base that no longer exists.

Mistake 2: one overall number instead of per-component results. A drop hidden inside one component group (for example retrieval) can be invisible in the overall pass rate Source 1সোর্স 1.

Mistake 3: running the regression suite on a schedule instead of on the actual change. A nightly run finds a regression up to 24 hours after it shipped; a push-triggered run finds it before it ships.

Mistake 4: no threshold, just a report. A faithfulness number with nothing gating on it does not stop a bad update Source 3সোর্স 3.

Mistake 5: triggering the full suite on unrelated code changes. Scope the trigger to the knowledge base's own files, not the whole repository.

সহজ English

Mistake 1: making the test set once and reusing it forever. A new set tests the current knowledge base. An old set tests a knowledge base that no longer exists.

Mistake 2: one overall number instead of results for each component. A drop inside one group, such as retrieval, can hide in the overall pass rate Source 1সোর্স 1.

Mistake 3: running the tests on a schedule instead of on the change. A nightly run can find a regression up to 24 hours after it shipped. A run on each push finds it before it ships.

Mistake 4: no threshold, only a report. A faithfulness number with no gate on it does not stop a bad update Source 3সোর্স 3.

Mistake 5: running the full suite on unrelated code changes. Limit the trigger to the knowledge base's own files, not the whole repository.

বাংলা ব্যাখ্যা

ভুল ১: একবার test set generate করে চিরকাল আবার ব্যবহার করা। একটা regenerate করা সেট বর্তমান knowledge base টেস্ট করে; একটা পুরনো সেট এমন একটা knowledge base টেস্ট করে যা আর নেই।

ভুল ২: per-component ফলাফলের বদলে একটা সার্বিক সংখ্যা। একটা component group-এর (যেমন retrieval) ভেতরে লুকানো একটা পতন সার্বিক pass rate-এ অদৃশ্য হতে পারে Source 1সোর্স 1।

ভুল ৩: আসল পরিবর্তনের বদলে regression suite একটা schedule-এ চালানো। একটা nightly run একটা regression ship হওয়ার ২৪ ঘণ্টা পর পর্যন্ত খুঁজে পায়; একটা push-trigger করা run এটা ship হওয়ার আগে খুঁজে পায়।

ভুল ৪: threshold নেই, শুধু একটা রিপোর্ট। কিছু gate না করা একটা faithfulness সংখ্যা একটা খারাপ update থামায় না Source 3সোর্স 3।

ভুল ৫: অসম্পর্কিত code পরিবর্তনে পুরো suite trigger করা। trigger-কে knowledge base-এর নিজস্ব ফাইলে সীমাবদ্ধ করুন, পুরো repository-তে নয়।

What a tester can check

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Confirm the test set is regenerated on every run, not cached from a previous one.
  • Keep and review the per-component breakdown, not only the overall pass rate.
  • Confirm the pipeline triggers on a knowledge base change, scoped to its own path.
  • Confirm the threshold actually blocks the deploy step when it fails, not just logs a warning.

সহজ English

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Confirm the test set is regenerated on every run, not cached from a previous one.
  • Keep and review the per-component breakdown, not only the overall pass rate.
  • Confirm the pipeline triggers on a knowledge base change, scoped to its own path.
  • Confirm the threshold actually blocks the deploy step when it fails, not just logs a warning.

বাংলা ব্যাখ্যা

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • প্রতিটা run-এ test set regenerate হয়, আগেরটা থেকে cache করা নয়, তা নিশ্চিত করুন।
  • শুধু সার্বিক pass rate নয়, per-component breakdown রাখুন আর review করুন।
  • pipeline একটা knowledge base পরিবর্তনে trigger হয়, তার নিজস্ব path-এ সীমাবদ্ধ, তা নিশ্চিত করুন।
  • threshold ব্যর্থ হলে আসলেই deploy ধাপ ব্লক করে, শুধু warning log করে না, তা নিশ্চিত করুন।

Key words

WordWhat it means
Giskard quality scanA Giskard v3 scan that generates RAG test scenarios from a knowledge base (successor of v2 RAGET)
Component tagA label on a generated scenario saying which part it stresses: llm, retrieval, or history
Regression suiteA test set re-run on every knowledge base change to catch what the update broke
Path-scoped triggerA CI trigger limited to changes under a specific directory

Reels on this topicএই টপিকের রিলস

Short videos from other creators, picked for this topic. They are not part of this page's fact-checked text. Nothing loads from YouTube until you press Play.অন্য ক্রিয়েটরদের বানানো ছোট ভিডিও, এই টপিকের জন্য বাছাই করা। এগুলো এই পেজের ফ্যাক্ট-চেক করা লেখার অংশ নয়। চালান বাটন চাপার আগে YouTube থেকে কিছুই লোড হয় না।

  1. [1]
    Run a Quality Scan

    Giskard (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  2. [2]
    Migrate from Giskard v2 to v3

    Giskard (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  3. [3]
    Available metrics

    Ragas (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  4. [4]
    GitHub Actions documentation

    GitHub · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  5. [5]
    Workflow syntax for GitHub Actions

    GitHub · accessed 2026-11-27দেখা হয়েছে: 2026-11-27