result_data in evaluation response

This commit is contained in:
Xi Yan 2025-03-18 22:09:35 -07:00
parent 08c0c5505e
commit a92756a4b7
3 changed files with 43 additions and 32 deletions

View file

@ -8653,7 +8653,7 @@
"EvaluationResponse": { "EvaluationResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"generations": { "result_data": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "type": "object",
@ -8680,20 +8680,39 @@
] ]
} }
}, },
"description": "The generations in rows for the evaluation." "description": "The result data containing generations and grades in each row."
}, },
"scores": { "metrics": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/ScoringResult" "oneOf": [
{
"type": "null"
}, },
"description": "The scores for the evaluation. Map of grader id to ScoringResult." {
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "Map of metric name to aggregated value."
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"generations", "result_data",
"scores" "metrics"
], ],
"title": "EvaluationResponse", "title": "EvaluationResponse",
"description": "A response to an inline evaluation." "description": "A response to an inline evaluation."

View file

@ -6018,7 +6018,7 @@ components:
EvaluationResponse: EvaluationResponse:
type: object type: object
properties: properties:
generations: result_data:
type: array type: array
items: items:
type: object type: object
@ -6031,17 +6031,22 @@ components:
- type: array - type: array
- type: object - type: object
description: >- description: >-
The generations in rows for the evaluation. The result data containing generations and grades in each row.
scores: metrics:
type: object type: object
additionalProperties: additionalProperties:
$ref: '#/components/schemas/ScoringResult' oneOf:
description: >- - type: 'null'
The scores for the evaluation. Map of grader id to ScoringResult. - type: boolean
- type: number
- type: string
- type: array
- type: object
description: Map of metric name to aggregated value.
additionalProperties: false additionalProperties: false
required: required:
- generations - result_data
- scores - metrics
title: EvaluationResponse title: EvaluationResponse
description: A response to an inline evaluation. description: A response to an inline evaluation.
HealthInfo: HealthInfo:

View file

@ -76,30 +76,17 @@ class EvaluationJob(CommonJobFields):
candidate: EvaluationCandidate candidate: EvaluationCandidate
@json_schema_type
class ScoringResult(BaseModel):
"""
A scoring result for a single row.
:param scores: The scoring result for each row. Each row is a map of grader column name to value.
:param metrics: Map of metric name to aggregated value.
"""
scores: List[Dict[str, Any]]
metrics: Dict[str, Any]
@json_schema_type @json_schema_type
class EvaluationResponse(BaseModel): class EvaluationResponse(BaseModel):
""" """
A response to an inline evaluation. A response to an inline evaluation.
:param generations: The generations in rows for the evaluation. :param result_data: The result data containing generations and grades in each row.
:param scores: The scores for the evaluation. Map of grader id to ScoringResult. :param metrics: Map of metric name to aggregated value.
""" """
generations: List[Dict[str, Any]] result_data: List[Dict[str, Any]]
scores: Dict[str, ScoringResult] metrics: Dict[str, Any]
class Evaluation(Protocol): class Evaluation(Protocol):