Data Models Reference
This document describes the core data models used in the Reward Kit for representing messages, evaluation results, and metrics.Message Models
Message
TheMessage
class represents a single message in a conversation.
Attributes
-
role
(str
): The role of the message sender. Typically one of:"user"
: Message from the user"assistant"
: Message from the assistant"system"
: System message providing context/instructions
-
content
(str
): The text content of the message. -
name
(Optional[str]
): Optional name of the sender (for named system messages). -
tool_call_id
(Optional[str]
): Optional ID for a tool call (used in tool calling). -
tool_calls
(Optional[List[Dict[str, Any]]]
): Optional list of tool calls in the message. -
function_call
(Optional[Dict[str, Any]]
): Optional function call information (legacy format).
Compatibility
TheMessage
class is compatible with OpenAI’s ChatCompletionMessageParam
interface, allowing for easy integration with OpenAI-compatible APIs.
Evaluation Models
EvaluateResult
TheEvaluateResult
class represents the complete result of an evaluator with multiple metrics.
Attributes
-
score
(float
): The overall evaluation score, typically between 0.0 and 1.0. -
reason
(Optional[str]
): Optional explanation for the overall score. -
metrics
(Dict[str, MetricResult]
): Dictionary of component metrics. -
error
(Optional[str]
): Optional error message if the evaluation encountered a problem.
MetricResult
TheMetricResult
class represents a single metric in an evaluation.
Attributes
-
score
(float
): The score for this specific metric, typically between 0.0 and 1.0. -
reason
(str
): Explanation for why this score was assigned. -
success
(bool
): Indicates whether the metric condition was met (e.g., pass/fail).