Update API docs: document judge_language in all score endpoints

- POST /api/score: add judge_language section with default/usage

- POST /api/score/async: mention judge_language in docstring

- POST /api/score/session_async: add to description string + JSON example

- ScoreRequest / SessionScoreRequest: add judge_language to schema example

- request_summary snapshots: include judge_language for observability

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
wangwei
2026-07-01 20:21:04 +08:00
co-authored by Copilot
parent 24a8688a34
commit 3a82d8c487
6 changed files with 20 additions and 3 deletions
+6 -2
View File
@@ -54,7 +54,8 @@ logger = logging.getLogger("webapp.api.session_score_jobs")
"- `contexts`:检索片段拼接字符串,按 `context_separator` 拆分。\n"
"- `ground_truth`:标准答案,可选;缺失时会自动跳过依赖它的指标。\n"
"- `metrics`:本次需要计算的指标列表。\n"
"- `judge_model` / `embedding_model`:可选;为空时回退到系统默认配置。\n\n"
"- `judge_model` / `embedding_model`:可选;为空时回退到系统默认配置。\n"
"- `judge_language`:评判 prompt 语言,`\"zh\"` 开启中文评判,默认 `null`(全局配置,出厂为 `\"en\"`)。\n\n"
"**处理行为**\n"
"1. 服务端立即返回 `202 Accepted`,并生成本次调用的 `job_id`。\n"
"2. 系统根据 `session_id` 计算固定 `run_id`,格式为 `session-<sanitized-session_id>`。\n"
@@ -75,7 +76,8 @@ logger = logging.getLogger("webapp.api.session_score_jobs")
" \"context_separator\": \" |||| \",\n"
" \"metrics\": [\"answer_relevancy\", \"faithfulness\"],\n"
" \"judge_model\": \"gpt-5.5\",\n"
" \"embedding_model\": \"text-embedding-3-small\"\n"
" \"embedding_model\": \"text-embedding-3-small\",\n"
" \"judge_language\": \"zh\"\n"
"}\n"
"```"
),
@@ -113,6 +115,8 @@ def submit_session_async_score(request: SessionScoreRequest) -> SessionScoreJobR
**适合 Dify 工作流**:在循环节点中批量调用,所有轮次共用同一 `session_id`
最终在 RAGAS 平台「运行列表」中查看完整的批量评估报告。
**`judge_language`**:传 `"zh"` 开启中文评判 prompt;默认 `null`(使用全局配置,出厂为 `"en"`)。
"""
logger.info(
"[session_async] submit session_id=%s metrics=%s has_ctx=%s has_gt=%s",