Protocols¶
These are the stable extension boundaries for package users.
DatasetProvider ¶
Bases: Protocol
Query-aware dataset provider used by the benchmark-first public surface.
Source code in themis/contracts/protocols.py
scan ¶
Return slice items after applying the requested dataset query.
InferenceEngine ¶
Bases: Protocol
Inference backend responsible for producing one candidate result.
Source code in themis/contracts/protocols.py
infer ¶
Extractor ¶
Bases: Protocol
Structured parser that turns raw model output into extracted data.
Source code in themis/contracts/protocols.py
extract ¶
extract(
trial: TrialSpec,
candidate: CandidateRecord,
config: Mapping[str, JSONValueType] | None = None,
) -> ExtractionRecord
Parse one candidate into a structured extraction record.
Metric ¶
Bases: Protocol
Scorer that turns a candidate plus context into one MetricScore.
Source code in themis/contracts/protocols.py
score ¶
JudgeService ¶
Bases: Protocol
Service object used by metrics that need extra judge-model calls.
Source code in themis/contracts/protocols.py
consume_audit_trail ¶
judge ¶
judge(
metric_id: str,
parent_candidate: CandidateRecord,
judge_spec: JudgeInferenceSpec,
prompt: PromptTemplateSpec,
runtime: MetricContext,
) -> InferenceRecord
Run one judge-model call and return the resulting inference record.
Source code in themis/contracts/protocols.py
PipelineHook ¶
Bases: Protocol
Pure transforms around inference, extraction, and evaluation stages.