simulation_judge

Judges a conversation against a simulation’s, or a rubric’s, success and criterion metrics.

The simulation driver judges a run with it when the run ends, and pipecat eval judge judges saved conversation files with it, so a conversation gets the same verdicts either way. With an EvalRubric, it judges a conversation no simulation produced, such as a production call. Measured metrics are not its part: they come from a live run, not from what was said.

class pipecat.evals.simulation_judge.EvalSimulationJudgement(goal: JudgeVerdict, metrics: list[EvalSimulationMetricScore])[source]

Bases: object

What the judge decided about one conversation.

Parameters:
  • goal – The verdict on the success: yes, no, or none when the judge gave none.

  • metrics – The criterion metrics’ outcomes, in the simulation’s order.

class pipecat.evals.simulation_judge.EvalSimulationJudge(simulation: EvalSimulationScenario | EvalRubric, *, judge: EvalJudge | None = None, explain_below: float | None = None, trace: EvalTrace | None = None)[source]

Bases: object

Judges conversations against a simulation or a rubric.

Each conversation is judged by a judge built from the simulation’s judge config, closed once the conversation is judged. A judge passed in is used instead and left open for its owner to close; it keeps the conversation it is told, so it judges one conversation.

Example:

scenario = EvalScenarioFile.load("book_table.yaml")["book_table/available"]
messages = json.loads(Path("run.conversation.json").read_text(encoding="utf-8"))
judgement = await EvalSimulationJudge(scenario).judge(messages)

A production call, recorded by EvalConversationObserver:

rubric = EvalScenarioFile.load("food_ordering.yaml")["food_ordering/production"]
judgement = await EvalSimulationJudge(rubric).judge(message.conversation)
__init__(simulation: EvalSimulationScenario | EvalRubric, *, judge: EvalJudge | None = None, explain_below: float | None = None, trace: EvalTrace | None = None)[source]

Initialize the simulation judge.

Parameters:
  • simulation – The simulation, or the rubric, whose success and metrics to judge.

  • judge – The judge to ask, which should not have seen any conversation yet; None builds one for each conversation.

  • explain_below – For the judges it builds, a yes less sure than this is explained too (above 1, every verdict is); None keeps the simulation’s judge config.

  • trace – The run’s trace, to log each verdict in, or None.

static call_lines(message: dict) → list[str][source]

A tool_call message as the judge reads it: the call, and a line more when it was cancelled.

async judge(messages: list[dict]) → EvalSimulationJudgement[source]

Judge a conversation, its messages as a conversation file holds them.

Parameters:

messages – The conversation (see pipecat.evals.conversation).

Returns:

The verdict on the goal and the criterion metrics’ outcomes.