Skip to content

datarobot_genai.eval.benchmarks.response_acceptability

response_acceptability

Response Acceptability: how acceptable is the response given example answers (LLM-as-judge).

The judge-based twin of response_similarity, reading the same dataset. Instead of counting shared words, a judge sees the example answers and rates how well the agent's response matches them in substance. It catches paraphrases that the lexical metrics miss, at the cost of a judge call per case.

The examples are illustrations, not an exhaustive list: a response can score 5 without matching any of them word for word.

Scoring (judge-based): the judge rates 1-5 on the rubric below, mapped to 0.2..1.0. With the default 0.5 pass threshold, a rating of 3 or more passes. The reason repeats the rubric line for the rating the judge gave.

Dataset fields

input (required) the prompt sent to the agent acceptable_responses (required) str | list[str] example good answers unacceptable_responses (optional) str | list[str] example bad answers notes (optional) extra grading guidance for the judge

metric is ignored here, so one dataset can drive both benchmarks. A case with no acceptable_responses is scored inconclusive.

build_criteria

build_criteria(unacceptable: list[str], notes: str) -> str

Build the optional criteria block: unacceptable examples and extra guidance.

Source code in datarobot_genai/eval/benchmarks/response_acceptability.py
def build_criteria(unacceptable: list[str], notes: str) -> str:
    """Build the optional criteria block: unacceptable examples and extra guidance."""
    parts = []
    if unacceptable:
        parts.append(f"Unacceptable example answers:\n{_bullets(unacceptable)}")
    if notes:
        parts.append(f"Additional guidance: {notes}")
    return "\n".join(parts)

score_sample

score_sample(sample: Any) -> dict[str, Any]

Scoring logic behind score, separate so tests can call it undecorated.

Source code in datarobot_genai/eval/benchmarks/response_acceptability.py
def score_sample(sample: Any) -> dict[str, Any]:
    """Scoring logic behind ``score``, separate so tests can call it undecorated."""
    acceptable = _as_list(sample.metadata.get("acceptable_responses"))
    if not acceptable:
        return {"reason": "no acceptable_responses provided: cannot score"}
    result = judge_score(
        sample,
        template=_TEMPLATE,
        grade_pattern=r"GRADE:\s*([1-5])",
        score_mapping=_SCORE_MAPPING,
        question=sample.metadata.get("input", ""),
        reference=_bullets(acceptable),
        criteria=build_criteria(
            _as_list(sample.metadata.get("unacceptable_responses")),
            sample.metadata.get("notes", ""),
        ),
    )
    grade = result["judge_grade"]
    if grade in _JUDGE_ERROR_GRADES:
        return {"judge_grade": grade}
    value = result["judge_score"]
    return {
        "score": value,
        "acceptability": value,
        "judge_grade": grade,
        "reason": f"judge rated {grade}/5: {RUBRIC.get(grade, 'unrecognized grade')}",
    }

score

score(sample: ScorerInput) -> dict[str, Any]

Judge how acceptable the response is given the case's example answers.

Source code in datarobot_genai/eval/benchmarks/response_acceptability.py
@benchmark(  # type: ignore[untyped-decorator]
    name="response_acceptability",
    dataset="cases.jsonl",
    prompt="{input}",
    endpoint_type="chat",
    extra={"judge": JUDGE},
)
@scorer  # type: ignore[untyped-decorator]
def score(sample: ScorerInput) -> dict[str, Any]:
    """Judge how acceptable the response is given the case's example answers."""
    return score_sample(sample)