DeepEval: Pytest for LLMs
Promptfoo gives you a config and a table. DeepEval gives you code. That difference matters the moment your team wants the eval in the normal test suite.
9 min read9 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 5 sources5টি সোর্স · updated Nov 2026আপডেট: Nov 2026
One test, many judge callsএকটা টেস্ট, অনেক জাজ কল
Move the threshold and watch a score flip from pass to fail, then add cases and metrics and watch the judge calls grow.থ্রেশহোল্ড সরান আর দেখুন স্কোর পাস থেকে ব্যর্থ হয়ে যায়, তারপর কেস ও metric বাড়িয়ে জাজ কল বাড়তে দেখুন।
You’ll learnআপনি শিখবেন
- What a metric reads and returnsmetric কী পড়ে আর কী ফেরত দেয়
- Pass means score meets thresholdপাস মানে স্কোর threshold ছোঁয়া
- Why judge calls multiplyজাজ কল কেন গুণ হয়
- Why a bad answer test mattersখারাপ উত্তরের টেস্ট কেন জরুরি
In plain words
DeepEval plugs into Pytest: deepeval test run collects and runs your eval files the same way pytest would Source 1সোর্স 1. A test function builds a test case from the model's answer and checks it with one or more metrics. The metrics are the assertions.
DeepEval separates reference-based metrics (they need ground truth) from referenceless metrics (they need no labeled data) Source 2সোর্স 2. That difference is the one to remember. Which kind each metric below belongs to is the tutorial's own classification:
- Referenceless metrics work without labeled data.
AnswerRelevancyMetricasks whether the answer addresses the input.FaithfulnessMetricasks whether the answer contradicts theretrieval_context, the text your retriever fetched. These suit a chatbot that answers from a knowledge base, and they also work in production. - Reference-based metrics need ground truth.
HallucinationMetriccompares the answer with a ground-truthcontextSource 4সোর্স 4. AGEvalmetric can compare the answer with anexpected_output.
The metric catalogue is the reference to read before you design a suite.
The test function looks like any other test, which is the whole point:
# test_support.py
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric, HallucinationMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
def test_support_answer_is_relevant_and_grounded():
question = "How long do I have to return a laptop?"
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question),
context=["Unopened items can be returned within 30 days."],
)
assert_test(test_case, [AnswerRelevancyMetric(), HallucinationMetric()])Run the file with deepeval test run Source 1সোর্স 1:
deepeval test run test_support.pyBecause the file is a Pytest file, Pytest features such as parametrisation work in it.
সহজ English
DeepEval lets you write tests for an AI model's answers. You write them as normal Pytest tests. Pytest is a common tool for running tests.
The command deepeval test run finds your test files and runs them. It works the same way as pytest Source 1সোর্স 1.
Each test takes the model's answer and checks it. The checks are called metrics. A metric works like an assertion. It says whether the answer is good or not.
DeepEval separates reference-based metrics (they need ground truth) from referenceless metrics (they need no labeled data) Source 2সোর্স 2. This difference is the one to remember. Which kind each metric below belongs to is the tutorial's own classification.
- No right answer needed. These checks work without labeled data.
AnswerRelevancyMetricchecks that the answer is about the question.FaithfulnessMetricchecks that the answer does not contradict the text your search step fetched. That text is calledretrieval_context.- These fit a chatbot that answers from a knowledge base. They also work in production.
- A known truth is needed. These checks need a trusted right answer.
HallucinationMetriccompares the answer with a trustedcontextSource 4সোর্স 4.- A
GEvalmetric can compare the answer with anexpected_output.
Read the metric catalogue before you design a set of tests.
A test looks like any other test. That is the whole point.
# test_support.py
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric, HallucinationMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
def test_support_answer_is_relevant_and_grounded():
question = "How long do I have to return a laptop?"
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question),
context=["Unopened items can be returned within 30 days."],
)
assert_test(test_case, [AnswerRelevancyMetric(), HallucinationMetric()])Run the file like this Source 1সোর্স 1:
deepeval test run test_support.pyThe file is a Pytest file. So Pytest features also work in it. One example is parametrisation.
বাংলা ব্যাখ্যা
DeepEval Pytest-এর সাথে যুক্ত হয়: deepeval test run আপনার eval ফাইলগুলো ঠিক pytest-এর মতো করেই খুঁজে নিয়ে চালায় Source 1সোর্স 1। একটা টেস্ট ফাংশন model-এর উত্তর থেকে একটা test case বানায়, আর এক বা একাধিক metric দিয়ে সেটা যাচাই করে। metric-গুলোই assertion।
DeepEval reference-based metric (ground truth লাগে) আর referenceless metric (labeled data লাগে না) আলাদা করে Source 2সোর্স 2। এই পার্থক্যটাই মনে রাখার মতো। নিচের কোন metric কোন ধরনের, সেই ভাগটা টিউটোরিয়ালের নিজস্ব:
- Referenceless metric labeled data ছাড়াই কাজ করে।
AnswerRelevancyMetricদেখে উত্তরটা input-এর প্রশ্নের জবাব দেয় কি না।FaithfulnessMetricদেখে উত্তরটাretrieval_context-এর, মানে আপনার retriever যে লেখা এনেছে তার, বিরোধিতা করে কি না। knowledge base থেকে উত্তর দেওয়া chatbot-এর জন্য এগুলো মানায়, আর production-এও এগুলো চলে। - Reference-based metric-এর ground truth লাগে।
HallucinationMetricউত্তরকে একটা ground-truthcontext-এর সাথে তুলনা করে Source 4সোর্স 4। একটাGEvalmetric উত্তরকেexpected_output-এর সাথে তুলনা করতে পারে।
suite ডিজাইন করার আগে metric-এর তালিকাটা পড়ে নিন।
টেস্ট ফাংশনটা দেখতে যেকোনো সাধারণ টেস্টের মতো, আর এটাই মূল কথা:
# test_support.py
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric, HallucinationMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
def test_support_answer_is_relevant_and_grounded():
question = "How long do I have to return a laptop?"
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question),
context=["Unopened items can be returned within 30 days."],
)
assert_test(test_case, [AnswerRelevancyMetric(), HallucinationMetric()])ফাইলটা deepeval test run দিয়ে চালান Source 1সোর্স 1:
deepeval test run test_support.pyফাইলটা যেহেতু Pytest ফাইল, তাই parametrisation-এর মতো Pytest-এর সুবিধাগুলো এতে কাজ করে।
How it works
A DeepEval test has three moving parts: the test case, the metric, and the assert_test call.
The test case (LLMTestCase) holds the inputs and the outputs. Its fields are:
inputis the question.actual_outputis what the model said.expected_outputis the reference answer, when you have one.contextis the ground truth that the answer should agree with.retrieval_contextis what your retriever actually fetched.
Different metrics read different fields. HallucinationMetric reads context Source 4সোর্স 4, and FaithfulnessMetric reads retrieval_context Source 5সোর্স 5.
Score and reason. The metric is the check. Each metric gives a score from 0 to 1 and a reason, and it passes when the score meets its threshold. Almost all of the built-in metrics use a model as the judge (LLM-as-a-judge) Source 2সোর্স 2. So they inherit the non-determinism of any other model call Source 2সোর্স 2.
Run in a test. The assert_test call runs the metrics on the test case inside a test, so a metric below its threshold fails that test. Everything runs locally Source 1সোর্স 1. If you are logged in to Confident AI, the results also appear there Source 1সোর্স 1.
Because it is Pytest, you get parametrisation for free, and that is how a real suite is built:
import pytest
@pytest.mark.parametrize(
"case",
[
"How long do I have to return a laptop?",
"Can I return an opened item?",
"What is your refund policy for electronics?",
],
)
def test_answer_is_grounded(case):
...Judge calls. The practical cost is the judge calls. A metric can make more than one model call for each test case. FaithfulnessMetric, for example, first extracts the claims from the answer and then checks each claim against the retrieval context Source 5সোর্স 5. So two metrics on fifty cases is at least a hundred judge calls. The tutorial's advice: run fast deterministic checks on every commit, and the metric tests on a schedule.
সহজ English
A DeepEval test has three parts: the test case, the metric, and the assert_test call.
The test case holds what went in and what came out. input is the question. actual_output is the model's answer. expected_output is the right answer, if you have one. context is the trusted truth the answer should agree with. retrieval_context is what your search step really found. Each metric reads its own fields: HallucinationMetric reads context Source 4সোর্স 4, and FaithfulnessMetric reads retrieval_context Source 5সোর্স 5.
The metric is the check. It gives a score from 0 to 1 and a reason, and it passes when the score reaches its threshold. Almost all built-in metrics ask a model to judge, so the result can vary like any model answer Source 2সোর্স 2.
The assert_test call runs the metrics inside a test. If a score is below its threshold, the test fails. It all runs on your machine; if you log in to Confident AI, you also see the results there Source 1সোর্স 1.
Because it is Pytest, you can run one test with many inputs:
import pytest
@pytest.mark.parametrize(
"case",
[
"How long do I have to return a laptop?",
"Can I return an opened item?",
"What is your refund policy for electronics?",
],
)
def test_answer_is_grounded(case):
...The real cost is the judge calls. One metric can call the model more than once per case. FaithfulnessMetric, for example, first pulls out the claims and then checks each one Source 5সোর্স 5. So two metrics on fifty cases means at least a hundred judge calls. The tutorial's advice: run quick rule checks on every commit, and the metric tests on a schedule.
বাংলা ব্যাখ্যা
একটা DeepEval টেস্টের তিনটা অংশ: test case, metric, আর assert_test call।
Test case (LLMTestCase)-এ থাকে input আর output। input হলো প্রশ্ন। actual_output হলো model যা বলেছে। expected_output হলো reference উত্তর, যদি থাকে। context হলো সেই ground truth, যার সাথে উত্তরটা মিলতে হবে। retrieval_context হলো আপনার retriever আসলে যা এনেছে। আলাদা metric আলাদা field পড়ে: HallucinationMetric পড়ে context Source 4সোর্স 4, আর FaithfulnessMetric পড়ে retrieval_context Source 5সোর্স 5।
Metric হলো চেক। প্রতিটা metric ০ থেকে ১-এর মধ্যে একটা স্কোর আর একটা কারণ দেয়, আর স্কোর threshold ছুঁলে pass করে। প্রায় সব built-in metric বিচারক হিসেবে একটা model ব্যবহার করে (LLM-as-a-judge), তাই অন্য যেকোনো model call-এর মতো এদের ফলাফলও বদলাতে পারে Source 2সোর্স 2।
assert_test call টেস্টের ভেতরে test case-এর ওপর metric-গুলো চালায়, তাই কোনো metric threshold-এর নিচে থাকলে সেই টেস্ট fail করে। সবকিছু আপনার মেশিনেই চলে; Confident AI-তে login করা থাকলে ফলাফল সেখানেও দেখা যায় Source 1সোর্স 1।
যেহেতু এটা Pytest, parametrisation বিনা খরচে পাবেন, আর আসল suite এভাবেই বানানো হয়:
import pytest
@pytest.mark.parametrize(
"case",
[
"How long do I have to return a laptop?",
"Can I return an opened item?",
"What is your refund policy for electronics?",
],
)
def test_answer_is_grounded(case):
...বাস্তব খরচ হলো judge call। একটা metric প্রতি test case-এ একাধিক model call করতে পারে: যেমন FaithfulnessMetric আগে উত্তর থেকে দাবিগুলো বের করে, তারপর প্রতিটা দাবি retrieval context-এর সাথে মিলিয়ে দেখে Source 5সোর্স 5। তাই পঞ্চাশটা কেসে দুটো metric মানে অন্তত একশোটা judge call। টিউটোরিয়ালের পরামর্শ: প্রতিটা commit-এ দ্রুত deterministic চেক চালান, আর metric টেস্ট চালান নির্দিষ্ট সময় পরপর।
In practice
Split the suite by cost, so the expensive part runs less often. Put the tests with the most judge calls in their own file:
# tests/ai/test_relevancy.py - few judge calls: run on every pull request
import pytest
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
QUESTIONS = [
"How long do I have to return a laptop?",
"Can I return an opened item?",
"Who pays the return shipping?",
]
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_relevant(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
)
assert_test(test_case, [AnswerRelevancyMetric(threshold=0.7)])# tests/ai/test_faithfulness.py - more judge calls per case: run nightly
import pytest
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
from tests.ai.test_relevancy import QUESTIONS
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_faithful_to_the_policy(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
retrieval_context=[RETURN_POLICY],
)
assert_test(test_case, [FaithfulnessMetric(threshold=0.8)])Run each file on its own schedule (the schedule is the tutorial's advice) Source 1সোর্স 1:
deepeval test run tests/ai/test_relevancy.py # every pull request
deepeval test run tests/ai/test_faithfulness.py # nightlyOne thing to check carefully: the threshold. The default is 0.5 for all metrics Source 2সোর্স 2. That is a default, not a quality bar that you chose. The tutorial's method: run the suite once on the current prompt, look at the score distribution, and set the threshold where the known-bad cases fall below it and the known-good ones stay above. Then read the scores with care: Anthropic warns against overinterpreting the quantitative score of any eval Source 3সোর্স 3.
সহজ English
Split the tests by cost, so the expensive ones run less often. Put the tests with the most judge calls in their own file:
# tests/ai/test_relevancy.py - few judge calls: run on every pull request
import pytest
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
QUESTIONS = [
"How long do I have to return a laptop?",
"Can I return an opened item?",
"Who pays the return shipping?",
]
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_relevant(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
)
assert_test(test_case, [AnswerRelevancyMetric(threshold=0.7)])# tests/ai/test_faithfulness.py - more judge calls per case: run nightly
import pytest
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
from tests.ai.test_relevancy import QUESTIONS
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_faithful_to_the_policy(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
retrieval_context=[RETURN_POLICY],
)
assert_test(test_case, [FaithfulnessMetric(threshold=0.8)])Run each file on its own schedule. The schedule below is the tutorial's advice Source 1সোর্স 1:
deepeval test run tests/ai/test_relevancy.py # every pull request
deepeval test run tests/ai/test_faithfulness.py # nightlyCheck the threshold with care. By default it is 0.5 for every metric Source 2সোর্স 2. That is a default, not a pass mark you chose. The tutorial's method: run the tests once, look at the scores, and set the threshold so that known-bad answers fall below it and known-good answers stay above. Do not read too much into one score; Anthropic warns about this Source 3সোর্স 3.
বাংলা ব্যাখ্যা
খরচ অনুযায়ী suite ভাগ করুন, যাতে ব্যয়বহুল অংশটা কম চলে। সবচেয়ে বেশি judge call লাগে এমন টেস্টগুলো আলাদা ফাইলে রাখুন:
# tests/ai/test_relevancy.py - few judge calls: run on every pull request
import pytest
from deepeval import assert_test
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
QUESTIONS = [
"How long do I have to return a laptop?",
"Can I return an opened item?",
"Who pays the return shipping?",
]
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_relevant(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
)
assert_test(test_case, [AnswerRelevancyMetric(threshold=0.7)])# tests/ai/test_faithfulness.py - more judge calls per case: run nightly
import pytest
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase
from app.support import answer_question
from fixtures.policies import RETURN_POLICY
from tests.ai.test_relevancy import QUESTIONS
@pytest.mark.parametrize("question", QUESTIONS)
def test_answer_is_faithful_to_the_policy(question):
test_case = LLMTestCase(
input=question,
actual_output=answer_question(question, context=RETURN_POLICY),
retrieval_context=[RETURN_POLICY],
)
assert_test(test_case, [FaithfulnessMetric(threshold=0.8)])প্রতিটা ফাইল তার নিজের সময়সূচিতে চালান (সময়সূচিটা টিউটোরিয়ালের পরামর্শ) Source 1সোর্স 1:
deepeval test run tests/ai/test_relevancy.py # every pull request
deepeval test run tests/ai/test_faithfulness.py # nightlyএকটা বিষয় মনোযোগ দিয়ে দেখুন: threshold। সব metric-এর default 0.5 Source 2সোর্স 2। এটা একটা default, আপনার বেছে নেওয়া মানের মাপকাঠি নয়। টিউটোরিয়ালের পদ্ধতি: বর্তমান prompt-এ একবার suite চালান, স্কোরগুলো কীভাবে ছড়িয়ে আছে দেখুন, আর threshold এমন জায়গায় বসান যাতে known-bad কেসগুলো নিচে আর known-good কেসগুলো ওপরে থাকে। তারপর স্কোর সাবধানে পড়ুন: যেকোনো eval-এর সংখ্যাগত স্কোরকে অতিরিক্ত ব্যাখ্যা করা নিয়ে Anthropic সতর্ক করে Source 3সোর্স 3।
Common mistakes
Mistake 1: leaving the threshold at the default. The default of 0.5 Source 2সোর্স 2 is not a bar you chose. Set the threshold from the score distribution of a known-good and a known-bad set.
Mistake 2: running every metric test on every commit. Each metric makes one or more judge calls. Put the expensive ones on a schedule and keep only deterministic checks in the inner loop.
Mistake 3: confusing context and retrieval_context. context is the ground truth and retrieval_context is what the retriever fetched, and different metrics read different fields (HallucinationMetric reads context Source 4সোর্স 4, FaithfulnessMetric reads retrieval_context Source 5সোর্স 5). Copying one into the other hides a retrieval bug.
Mistake 4: one big test function. When it fails you do not know which case or which metric failed. Parametrise.
Mistake 5: no reference answers. Without ground truth (context, retrieval_context or expected_output) you can only measure relevance, not correctness. Keep a reference for at least the important cases.
Mistake 6: treating the score as absolute. A 0.8 faithfulness score means nothing without the distribution behind it and the previous run to compare it to.
সহজ English
Mistake 1: keeping the default threshold. The default is 0.5 Source 2সোর্স 2, and nobody chose it for your app. Set it from the scores of answers you know are good and bad.
Mistake 2: running every metric test on every commit. Each metric makes one or more judge calls. Run the expensive ones on a schedule, and keep quick rule checks for every commit.
Mistake 3: mixing up context and retrieval_context. The first is the trusted truth. The second is what your search step found. Each metric reads its own field: HallucinationMetric reads context Source 4সোর্স 4, and FaithfulnessMetric reads retrieval_context Source 5সোর্স 5. If you copy one into the other, you hide a search bug.
Mistake 4: one big test. When it fails, you do not know which case or which metric failed. Use parametrisation.
Mistake 5: no right answers. Without a trusted source or right answer you can only check that the answer is on topic, not that it is correct. Keep right answers for the important cases.
Mistake 6: reading a score on its own. A faithfulness score of 0.8 means nothing without the other scores and the last run to compare it with.
বাংলা ব্যাখ্যা
ভুল ১: threshold default-এ রেখে দেওয়া। default 0.5 Source 2সোর্স 2 আপনার বেছে নেওয়া মাপকাঠি নয়। known-good আর known-bad সেটের স্কোর কীভাবে ছড়িয়ে আছে তা দেখে threshold বসান।
ভুল ২: প্রতিটা commit-এ সব metric টেস্ট চালানো। প্রতিটা metric এক বা একাধিক judge call করে। ব্যয়বহুলগুলো নির্ধারিত সময়ে রাখুন আর ভেতরের লুপে শুধু নির্দিষ্ট চেক রাখুন।
ভুল ৩: context আর retrieval_context গুলিয়ে ফেলা। context হলো ground truth, আর retrieval_context হলো retriever যা এনেছে; আলাদা metric আলাদা field পড়ে (HallucinationMetric পড়ে context Source 4সোর্স 4, FaithfulnessMetric পড়ে retrieval_context Source 5সোর্স 5)। একটাকে অন্যটায় কপি করলে retrieval বাগ ঢাকা পড়ে।
ভুল ৪: একটা বড় টেস্ট ফাংশন। ব্যর্থ হলে কোন কেস বা কোন metric ব্যর্থ হলো বোঝা যায় না। parametrise করুন।
ভুল ৫: reference উত্তর না থাকা। ground truth (context, retrieval_context বা expected output) ছাড়া আপনি শুধু relevancy মাপতে পারেন, সঠিকতা নয়। গুরুত্বপূর্ণ কেসগুলোর জন্য একটা reference রাখুন।
ভুল ৬: স্কোরকে একা একা পড়া। 0.8 faithfulness স্কোরের পিছনের বিতরণ আর আগের run না দেখে কিছু মানে আসে না।
What a tester can check
Tutorial advice
This advice is the tutorial's own. It does not come from the sources.
- Keep the DeepEval suite next to the application tests, in
tests/ai/. It is a Pytest suite and should feel like one. - Put the metric tests with the most judge calls in their own file from the start, even if they are fast today. The day they get slow, the split is already there.
- Record the metric scores in CI output as well as on Confident AI, if you use it. Confident AI is for history; the CI log is for the pull request.
- Store the
contextand theretrieval_contextseparately in the test case, even when they are equal today. The day they differ is the day you need it. - Save the judge model id with the scores. A score without the judge version cannot be compared with a later run.
- Write one test with a deliberately bad answer and check that the metric scores it low. A metric that passes everything measures nothing.
সহজ English
Tutorial advice
This advice is the tutorial's own. It does not come from the sources.
- Keep the DeepEval suite next to the application tests, in
tests/ai/. It is a Pytest suite and should feel like one. - Put the metric tests with the most judge calls in their own file from the start, even if they are fast today. The day they get slow, the split is already there.
- Record the metric scores in CI output as well as on Confident AI, if you use it. Confident AI is for history; the CI log is for the pull request.
- Store the
contextand theretrieval_contextseparately in the test case, even when they are equal today. The day they differ is the day you need it. - Save the judge model id with the scores. A score without the judge version cannot be compared with a later run.
- Write one test with a deliberately bad answer and check that the metric scores it low. A metric that passes everything measures nothing.
বাংলা ব্যাখ্যা
Tutorial advice
এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।
- DeepEval suite-টা অ্যাপের টেস্টের পাশে,
tests/ai/-তে রাখুন। এটা একটা Pytest suite, তাই এটাকে তেমনভাবেই রাখুন। - সবচেয়ে বেশি judge call লাগে এমন metric টেস্টগুলো শুরু থেকেই আলাদা ফাইলে রাখুন, আজ দ্রুত হলেও। যেদিন ধীর হবে, সেদিন ভাগটা আগে থেকেই করা থাকবে।
- metric স্কোর CI output-এও লিখুন, Confident AI ব্যবহার করলে সেখানেও। Confident AI ইতিহাসের জন্য, CI log pull request-এর জন্য।
- test case-এ
contextআরretrieval_contextআলাদা আলাদা রাখুন, আজও সমান হলেও। যেদিন আলাদা হবে, সেদিন এটা দরকার হবে। - স্কোরের সাথে judge model id সংরক্ষণ করুন। judge-এর version ছাড়া স্কোর পরের run-এর সাথে তুলনা যায় না।
- ইচ্ছাকৃতভাবে খারাপ একটা উত্তর দিয়ে একটা টেস্ট লিখুন আর দেখুন metric সেটাকে কম স্কোর দেয় কি না। সবকিছু পাস করা metric কিছুই মাপে না।
Key words
| Word | What it means |
|---|---|
| DeepEval | An LLM evaluation framework that plugs into Pytest |
| Metric | A scored check on an output, usually judged by a model |
| Threshold | The score a metric must reach for the test to pass |
| Referenceless metric | A metric that works without labeled data (ground truth) |
| Reference-based metric | A metric that needs ground truth, such as an expected output or a ground-truth context |
| LLMTestCase | The DeepEval object holding the input, the output, the context, and the reference |
| retrieval_context | What the retriever actually fetched; context is the ground truth |
| Confident AI | The hosted platform where DeepEval results also appear when you log in |
| assert_test | The DeepEval function that runs the metrics on a test case inside a test |