Add judge_language config plumbing (settings + scenario + ScoreRequest)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
wangwei
2026-07-01 17:47:21 +08:00
co-authored by Copilot
parent 03e682b89c
commit 4a646b6b9c
6 changed files with 95 additions and 0 deletions
+17
View File
@@ -48,6 +48,15 @@ class DistributionBin(BaseModel):
count: int
class SampleHistoryEntry(BaseModel):
"""One past evaluation of the same question, for the history comparison table."""
run_id: str
scenario_name: str = ""
finished_at: str = ""
metrics: dict[str, float | None] = Field(default_factory=dict)
class SampleScore(BaseModel):
"""Per-sample row used for the lowest-score review table."""
@@ -62,6 +71,10 @@ class SampleScore(BaseModel):
metrics: dict[str, float | None] = Field(default_factory=dict)
mean_score: float | None = None
error: str = ""
history: list[SampleHistoryEntry] = Field(
default_factory=list,
description="同一问题在以往运行中的评分(按时间倒序),用于历史对比。",
)
class ReportData(BaseModel):
@@ -460,6 +473,10 @@ class ScoreRequest(BaseModel):
default=None,
description="Embedding 模型名称;为 null 时使用 .env 中的 RAGAS_EMBEDDING_MODEL。",
)
judge_language: str | None = Field(
default=None,
description="评判 prompt 语言;'zh' 启用中文评判,为 null 时使用 RAGAS_JUDGE_LANGUAGE(默认 en)。",
)
@field_validator("metrics")
@classmethod