fix: change ScoreRequest json_schema_extra from examples list to example dict

Swagger UI Try it out was sending the {summary, value} wrapper as request body
instead of just the value contents, causing 422 errors. The 'example' (singular)
key is correctly used as the schema-level example by Swagger UI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-23 10:03:46 +08:00
parent 5ced129ff7
commit 1304fec1c4

View File

@@ -408,26 +408,21 @@ class ScoreRequest(BaseModel):
model_config = ConfigDict( model_config = ConfigDict(
json_schema_extra={ json_schema_extra={
"examples": [ "example": {
{ "question": "双源CT的时间分辨率是多少?",
"summary": "基础评分请求", "answer": "双源CT的单扇区时间分辨率为75ms。",
"value": { "contexts": "双源CT采用两套管-探测器系统 |||| 单扇区采集旋转135度",
"question": "双源CT时间分辨率是多少?", "ground_truth": "双源CT单扇区时间分辨率为75ms需旋转135度。",
"answer": "双源CT的单扇区时间分辨率为75ms。", "context_separator": " |||| ",
"contexts": "双源CT采用两套管-探测器系统 |||| 单扇区采集旋转135度", "metrics": [
"ground_truth": "双源CT单扇区时间分辨率为75ms需旋转135度。", "faithfulness",
"context_separator": " |||| ", "answer_relevancy",
"metrics": [ "context_recall",
"faithfulness", "context_precision",
"answer_relevancy", ],
"context_recall", "judge_model": "deepseek-v4-flash",
"context_precision", "embedding_model": "text-embedding-v3",
], }
"judge_model": "deepseek-v4-flash",
"embedding_model": "text-embedding-v3",
},
}
]
} }
) )