ExperimentItemModel¶
- class opik.message_processing.emulation.models.ExperimentItemModel(id: str, experiment_id: str, trace_id: str, dataset_item_id: str)¶
Bases:
objectRepresents an experiment item model that links a trace to a dataset item in an experiment.
- id¶
Unique identifier for the experiment item.
- Type:
str
- experiment_id¶
The ID of the experiment this item belongs to.
- Type:
str
- trace_id¶
The ID of the trace associated with this experiment item.
- Type:
str
- dataset_item_id¶
The ID of the dataset item associated with this experiment item.
- Type:
str
- __init__(id: str, experiment_id: str, trace_id: str, dataset_item_id: str) None¶
Description¶
ExperimentItemModel links a trace produced during evaluation to the dataset item
and experiment run that generated it. The SDK instantiates these records for you
while opik.evaluate() or experiment reruns execute; most users interact with
them through ScoreResult.metadata rather than constructing instances manually.
Metrics that analyse evaluation outputs can rely on this structure to connect
results back to source data.
Attributes¶
- opik.message_processing.emulation.models.id: str
Unique identifier for the experiment item record.
- opik.message_processing.emulation.models.experiment_id: str
Identifier of the experiment that produced this item.
- opik.message_processing.emulation.models.trace_id: str
Identifier of the trace logged during the evaluation run.
- opik.message_processing.emulation.models.dataset_item_id: str
Identifier of the dataset item evaluated in this experiment result.
Usage Example¶
The SDK populates ExperimentItemModel instances automatically while running evaluations:
from opik.message_processing.emulation.models import ExperimentItemModel
experiment_item = ExperimentItemModel(
id="exp_item_001",
experiment_id="exp_123",
trace_id="trace_abc",
dataset_item_id="dataset_item_xyz",
)
See Also¶
TraceModel- Stores the trace referenced bytrace_id.SpanModel- Contains spans that reference the same experiment item.evaluate - How experiments produce trace results.