Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Offline Test Runner

Reference for JudgeVersionPin, OfflineTestRunner, normalize_judge_versions, and build_agent_kwargs.

PropType
AgentFunction?Any
TypeAny
DefaultCallable[..., Any]
PassConditionFn?Any
TypeAny
DefaultCallable[[Dict[str, Any], List[ScorerData]], bool]
TERMINAL_STATUSES?Any
TypeAny
Defaultfrozenset({'completed', 'error', 'cancelled'})
EXAMPLES_PAGE_SIZE?Any
TypeAny
Default100
ITEMS_PAGE_SIZE?Any
TypeAny
Default200

normalize_judge_versions()

Validate and normalize judge_versions entries.

Each entry must identify a judge by name (or judge_id) and may pin a tag, version, or major_version/minor_version pair. Judges not listed default to their prod tag (else latest) server-side.

ValueError: If an entry is not a dict or identifies no judge.

def normalize_judge_versions(judge_versions) -> Optional[List[Dict[str, Any]]]:

Parameters

PropType
judge_versionsOptional[List[JudgeVersionPin]]
TypeOptional[List[JudgeVersionPin]]

Returns

Optional[List[Dict[str, Any]]]


build_agent_kwargs()

Map an example’s data fields onto the agent entrypoint’s parameters.

Each declared parameter is filled from the example field of the same name, or from a custom-mapped field via field_mapping (which maps each parameter name to the dataset field it reads). Example fields the entrypoint does not declare are ignored – so a dataset can carry extra columns (e.g. trace) the agent doesn’t use – unless the entrypoint accepts **kwargs, in which case the leftover fields are passed through too. The match succeeds as long as the example supplies every required (no-default) parameter.

TypeError: only if a required parameter has no matching example field.

def build_agent_kwargs(agent_function, data, field_mapping=None) -> Dict[str, Any]:

Parameters

PropType
agent_functionAgentFunction
TypeAgentFunction
dataDict[str, Any]
TypeDict[str, Any]
field_mapping?Optional[Dict[str, str]]
TypeOptional[Dict[str, str]]
DefaultNone

Returns

Dict[str, Any]


_parse_reason()

Coerce a stored scorer reason into the {text, citations?} wire shape.

def _parse_reason(raw) -> Dict[str, Any]:

Parameters

PropType
rawAny
TypeAny

Returns

Dict[str, Any]


_reason_text()

def _reason_text(raw) -> Optional[str]:

Parameters

PropType
rawAny
TypeAny

Returns

Optional[str]

Was this page helpful?