An LLMJudge with a vague prompt is a test whose verdict is sampled. It passes
today, fails tomorrow, and nobody trusts the suite. This tutorial shows the
failure first, then climbs a ladder of increasingly cheap and stable checks.
βIs this a good response?β gives the model nothing to measure against, so the
verdict follows the sampled reasoning. Run the same scenario three times and
compare.
run 1: CheckStatus.PASS β The response is clear, concise, and provides the necessary information regarding refund processing time and notification.
run 2: CheckStatus.PASS β The response provides a clear and concise answer to the userβs question about the refund timeline, including the time frame and an indication that the user will receive an email notification, which adds helpful detail.
run 3: CheckStatus.PASS β The response provides a clear and concise answer to the userβs question about the refund timeframe. It includes the processing duration and mentions the notification via email, which adds helpful information.
Even when all three runs agree on the verdict, the reasons differ β which
means the criterion is being invented on each call rather than applied. A
requirement that the model has to guess is a requirement you have not written
down yet.
Most βis it goodβ requirements decompose into facts. If the answer must state
the 5-business-day window, that is a substring, not a judgement call:
zero cost, zero variance.
from giskard.checks import FnCheck, StringMatching
result =awaitrun_with(
StringMatching(
name="states_5_business_days",
keyword="5 business days",
text_key="trace.last.outputs",
)
)
result.print_report()
Output
ββββββββββββββββββββββββββββββββββββββββββββββββββββ β PASSED ββββββββββββββββββββββββββββββββββββββββββββββββββββstates_5_business_daysPASSββββββββββββββββββββββββββββββββββββββββββββββββββββββ Trace ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Interaction 1 ββββββββββββββββββββββββββββββββββββββββββββββββββ
Inputs: 'How long does a refund take?'
Outputs: 'Refunds are processed within 5 business days. You will get an email once the money is on its way back to your card.'ββββββββββββββββββββββββββββββββββββββββββββ 1 step in 4ms | runs: 1/1 ββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ β PASSED ββββββββββββββββββββββββββββββββββββββββββββββββββββshort_enoughPASSββββββββββββββββββββββββββββββββββββββββββββββββββββββ Trace ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Interaction 1 ββββββββββββββββββββββββββββββββββββββββββββββββββ
Inputs: 'How long does a refund take?'
Outputs: 'Refunds are processed within 5 business days. You will get an email once the money is on its way back to your card.'ββββββββββββββββββββββββββββββββββββββββββββ 1 step in 1ms | runs: 1/1 ββββββββββββββββββββββββββββββββββββββββββββ
When the wording is free but the meaning is fixed, an embedding comparison
buys tolerance to paraphrase while staying deterministic for a given pair of
texts. Tune threshold on a handful of known-good and known-bad answers rather
than guessing.
from giskard.checks import SemanticSimilarity
result =awaitrun_with(
SemanticSimilarity(
embedding_model=embedding_model,
name="matches_refund_policy",
reference_text="Refunds take about five business days and you get a confirmation email.",
threshold=0.6,
)
)
result.print_report()
Output
ββββββββββββββββββββββββββββββββββββββββββββββββββββ β PASSED ββββββββββββββββββββββββββββββββββββββββββββββββββββmatches_refund_policyPASSββββββββββββββββββββββββββββββββββββββββββββββββββββββ Trace ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Interaction 1 ββββββββββββββββββββββββββββββββββββββββββββββββββ
Inputs: 'How long does a refund take?'
Outputs: 'Refunds are processed within 5 business days. You will get an email once the money is on its way back to your card.'βββββββββββββββββββββββββββββββββββββββββββ 1 step in 150ms | runs: 1/1 βββββββββββββββββββββββββββββββββββββββββββ
run 1: CheckStatus.PASS β The answer provides a time frame for the refund (5 business days), does not guarantee that a refund will be approved, and clarifies that the refund is not instant.
run 2: CheckStatus.PASS β The answer states a time frame (5 business days), does not guarantee a refund approval, and does not claim the refund is instant or immediate.
run 3: CheckStatus.PASS β The answer states a time frame for the refund (5 business days), does not guarantee a refund will be approved, and does not claim the refund is instant or immediate.
The verdicts now agree, and the messages point at a specific numbered rule
instead of a mood.