FeedbackScoreModel¶
- class opik.message_processing.emulation.models.FeedbackScoreModel(id: str, name: str, value: float, category_name: str | None = None, reason: str | None = None)¶
Bases:
object
Represents a model for a feedback score used to evaluate specific spans or traces.
This class stores and manages feedback scores linked to defined criteria, including identifiers, names, values, categories, and explanations for each score.
- id¶
Unique identifier for the feedback score.
- Type:
str
- name¶
Name associated with the feedback score.
- Type:
str
- value¶
The numerical value of the feedback score.
- Type:
float
- category_name¶
Category to which the feedback score belongs, if any.
- Type:
str | None
- reason¶
Reason or explanation for the feedback score, if available.
- Type:
str | None
- id: str¶
- name: str¶
- value: float¶
- category_name: str | None = None¶
- reason: str | None = None¶
- __init__(id: str, name: str, value: float, category_name: str | None = None, reason: str | None = None) None ¶
Description¶
The FeedbackScoreModel
class represents a feedback score used to evaluate specific spans or traces in the Opik system. It stores and manages feedback scores linked to defined criteria, including identifiers, names, values, categories, and explanations for each score.
This model is typically used in evaluation contexts where you need to score or rate the performance of traces and spans based on various metrics.
Attributes¶
- opik.message_processing.emulation.models.id: str¶
Unique identifier for the feedback score.
- opik.message_processing.emulation.models.name: str¶
Name associated with the feedback score, typically describing the metric being measured.
- opik.message_processing.emulation.models.value: float¶
The numerical value of the feedback score. This represents the actual score or rating assigned.
- opik.message_processing.emulation.models.category_name: str | None = None¶
Category to which the feedback score belongs, if any. This can be used to group related feedback scores together.
- opik.message_processing.emulation.models.reason: str | None = None¶
Reason or explanation for the feedback score, if available. This provides context for why a particular score was assigned.
Examples¶
Creating a basic feedback score:
from opik.message_processing.emulation.models import FeedbackScoreModel
# Create a feedback score for a quality metric
feedback_score = FeedbackScoreModel(
id="score_123",
name="response_quality",
value=0.85,
category_name="quality",
reason="Response was accurate and well-structured"
)
Creating a feedback score with minimal information:
# Create a simple feedback score
simple_score = FeedbackScoreModel(
id="score_456",
name="accuracy",
value=1.0
)
Usage in Evaluation¶
FeedbackScoreModel
objects are commonly used in:
Evaluation Metrics: Storing results from custom evaluation metrics
Span Scoring: Associating quality scores with specific spans
Trace Evaluation: Rating overall trace performance
A/B Testing: Comparing different model outputs with scored feedback
See Also¶
SpanModel
- Contains lists of feedback scoresTraceModel
- Also contains lists of feedback scores../evaluation/index - For information about evaluation metrics that generate these scores