From 94a6eb9c64cc13984e270381cd7204781667d03e Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Wed, 21 Oct 2026 18:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=9E=90=E6=9C=9F=E6=9C=9B=E7=9A=84?= =?UTF-8?q?=E4=B8=A4=E5=A4=84=E5=B0=8F=E4=BF=AE=EF=BC=9A=E6=9C=9F=E6=9C=9B?= =?UTF-8?q?=20SQL=20=E5=8F=AA=E8=BF=94=E5=9B=9E=E4=B8=A4=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E8=A1=A5=E4=B8=8A=E7=9A=84=E5=9F=BA=E6=9C=9F=E3=80=81=E6=9C=AC?= =?UTF-8?q?=E6=9C=9F=E5=86=99=E6=88=90=E6=96=87=E5=AD=97=E4=BA=A4=E7=BB=99?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=B7=A5=E5=85=B7=E7=9A=84=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=88=E6=9C=9F=E6=AC=A1=E6=98=AF=E6=95=B0=E7=9A=84=E4=B9=9F?= =?UTF-8?q?=E8=AE=A4=EF=BC=8C=E7=AE=97=E5=AD=90=E6=8C=89=E5=86=99=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=E6=A0=B7=E5=AD=90=E6=AF=94=EF=BC=89=EF=BC=9B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=92=8C=E7=BB=93=E6=9E=9C=E5=AF=B9=E4=B8=8D?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E5=8E=9F=E5=9B=A0=E5=89=8D=E9=9D=A2=E5=86=99?= =?UTF-8?q?=E3=80=8C=E7=AC=AC=20n=20=E4=B8=AA=E6=9C=9F=E6=9C=9B=EF=BC=88?= =?UTF-8?q?=E8=B4=A1=E7=8C=AE=EF=BC=89=E7=AE=97=E4=B8=8D=E5=87=BA=E6=9C=9F?= =?UTF-8?q?=E6=9C=9B=E3=80=8D=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=8F=A0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E3=80=8C=E7=9A=84=E3=80=8D=E3=80=82=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=A1=A5=E9=80=90=E9=A2=98=20E1=20=E9=A1=BA=E7=9D=80=E4=B8=8B?= =?UTF-8?q?=E9=92=BB=E6=89=BE=E5=88=B0=E4=B8=A4=E5=B1=82=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/eval/gold.py | 2 +- backend/app/eval/judgements.py | 3 ++- backend/tests/test_eval_analysis.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/app/eval/gold.py b/backend/app/eval/gold.py index e67f8271..98c094e0 100644 --- a/backend/app/eval/gold.py +++ b/backend/app/eval/gold.py @@ -448,7 +448,7 @@ async def _analysis_value(exp: Mapping[str, Any], at: int, found: _Analyses) -> try: request = judgements.request_of(exp, found.ctx.variables(), found.snapshot) except judgements.ParamsInvalid as e: - raise _NoValue(f"{where}的{e.message}") from None + raise _NoValue(f"{where}算不出期望,{e.message}") from None try: result = await analysis_ops.run(request, lambda name: inp if name == judgements.GOLD_REF else None, settings=settings, context=context, refuse_data_errors=True) diff --git a/backend/app/eval/judgements.py b/backend/app/eval/judgements.py index dedb09aa..d84e3c79 100644 --- a/backend/app/eval/judgements.py +++ b/backend/app/eval/judgements.py @@ -189,7 +189,8 @@ def _two_periods(snapshot: Mapping[str, Any], period: str) -> tuple[Any, Any]: order = sorted(range(2), key=lambda k: items[k].ordinal) else: order = sorted(range(2), key=lambda k: str(values[k])) - return values[order[0]], values[order[1]] + # 写成文字交给分析工具的参数(期次是数的也一样:算子按写出来的样子认期次列里的值) + return str(values[order[0]]), str(values[order[1]]) def request_of(exp: Mapping[str, Any], variables: Mapping[str, str], snapshot: Mapping[str, Any]) -> dict[str, Any]: diff --git a/backend/tests/test_eval_analysis.py b/backend/tests/test_eval_analysis.py index 44255487..edab6cd7 100644 --- a/backend/tests/test_eval_analysis.py +++ b/backend/tests/test_eval_analysis.py @@ -315,3 +315,13 @@ def test_the_summary_counts_outcomes_by_kind(): assert summary["outcomes_by_kind"] == {"contribution": {"traced": 1}, "verdict": {"wrong": 1}, "scalar": {"untraced": 1}} assert summary["outcomes"] == {"traced": 1, "wrong": 1, "untraced": 1} + + +def test_e1_follows_the_analysis_inputs_down_the_drill(): + """逐题 E1 拿产出答案的查询:引用的是下钻那一层的分析结论时,顺着上一层的结论找到两层各自读的查询。""" + from app.eval.score import _query_inputs + + found = {"a1": {"inputs": ["q1"]}, "a2": {"inputs": ["a1", "q2"]}} + assert _query_inputs(found["a2"], found, {"q1": {}, "q2": {}}) == ["q1", "q2"] + assert _query_inputs({"inputs": ["gone"]}, found, {"q1": {}}) == [], "取不回的输入不算" +