Wire judge-prompt localization into factory and inline scorer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
wangwei
2026-07-01 17:58:43 +08:00
co-authored by Copilot
parent 555328cb3b
commit bd5658c3ac
3 changed files with 135 additions and 5 deletions
+6 -1
View File
@@ -24,6 +24,7 @@ from ragas.metrics.collections import (
SemanticSimilarity,
)
from .judge_prompts import localize_pipeline_prompts
from .pipeline import MetricPipeline
@@ -133,7 +134,11 @@ def build_metric_pipeline(
# Build the full registry once using the shared factory, then slice by requested metrics.
registry = build_metric_registry(llm, embeddings)
selected = {name: registry[name] for name in scenario.metrics}
# Apply language-specific judge prompt localization (no-op for 'en').
language = scenario.judge_language or settings.ragas_judge_language or "en"
localize_pipeline_prompts(selected, language)
return MetricPipeline(
metrics={name: registry[name] for name in scenario.metrics},
metrics=selected,
metric_timeout_seconds=settings.ragas_metric_timeout_seconds,
)