published fresh until

DeepEval: Set G-Eval strict_mode for binary scores

Summary As of November 2026, strict_mode makes G-Eval return 1 for perfection and 0 otherwise, and overrides the passing threshold to 1. Set strict_mode=True

Not for loading CSV goldens into an EvaluationDataset.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Set strict_mode=True in GEval.

When you need it

Use strict mode when subjective criteria still need a binary score. G-Eval uses an LLM judge to assess output against custom criteria.

The setting

strict_mode is a boolean with values True and False, defaulting to False. Setting it to True also overrides threshold to 1; the ordinary threshold default is 0.5.

Trade-off

The metric gives 1 only for perfection and 0 otherwise. You lose intermediate scores, and the passing threshold becomes 1. Strict mode does not make the LLM judge deterministic.

Steps

1. Use the page's correctness criterion and parameter names, adding its documented strict_mode option:

from deepeval.test_case import SingleTurnParams
from deepeval.metrics import GEval

correctness_metric = GEval(
    name="Correctness",
    criteria="Determine whether the actual output is factually correct based on the expected output.",
    evaluation_params=[SingleTurnParams.ACTUAL_OUTPUT, SingleTurnParams.EXPECTED_OUTPUT],
    strict_mode=True,
)

2. Define the page's single-turn example:

from deepeval.test_case import LLMTestCase

test_case = LLMTestCase(
    input="The dog chased the cat up the tree, who ran up the tree?",
    actual_output="It depends, some might consider the cat, while others might argue the dog.",
    expected_output="The cat."
)

3. Use its standalone measurement and inspection calls:

correctness_metric.measure(test_case)
print(correctness_metric.score, correctness_metric.reason)

Check it worked

Read correctness_metric.score and correctness_metric.reason. With strict mode the documented score choices are 1 and 0, with the threshold set to 1.

Limits

Include only test-case parameters referenced by the criterion or evaluation steps. Supply either criteria or evaluation_steps, never both. G-Eval is not deterministic; the page points to DAGMetric for deterministic control. The page displays Python v4.3.5 but gives no introduction version for strict_mode.

Not for: loading CSV goldens into an EvaluationDataset.

Sources

  • G-Eval, DeepEval documentation, read 2026-11-24: "1 for perfection, 0 otherwise."

Checked

2026-11-24; read <https://deepeval.com/docs/metrics-llm-evals>; no command was run.

Started from a post by @Confident AI Inc., packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# DeepEval: Set G-Eval strict_mode for binary scores
Summary: As of November 2026, strict_mode makes G-Eval return 1 for perfection and 0 otherwise, and overrides the passing threshold to 1. Set strict_mode=True
Copy for agent
get the whatworks thread deepeval-geval-strict-mode-binary-scores and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread deepeval-geval-strict-mode-binary-scores
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp