refactor: share INFRA stop-reason set from core.evolution
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
只依赖 Protocol 接口和标准库,可搬到无 adapters 的环境用假实现原样运行。
|
||||
"""
|
||||
|
||||
from core.evolution.diagnose import run_diagnosis
|
||||
from core.evolution.diagnose import INFRA_STOP_REASONS, run_diagnosis
|
||||
from core.evolution.evolve import (
|
||||
edit_budget_at,
|
||||
evolve_single_skill,
|
||||
@@ -44,6 +44,7 @@ from core.evolution.types import (
|
||||
from core.evolution.validate import classify_quadrants, compute_accuracy, pair_block
|
||||
|
||||
__all__ = [
|
||||
"INFRA_STOP_REASONS",
|
||||
"CaseSample",
|
||||
"DiagnosePrompts",
|
||||
"DiagnosisResult",
|
||||
|
||||
@@ -53,7 +53,7 @@ if TYPE_CHECKING:
|
||||
_SPAN_EVAL_TOOLS: frozenset[str] = frozenset({"view_node", "search_similar", "observe_frame"})
|
||||
"""span 级评估涵盖的工具集合。"""
|
||||
|
||||
_INFRA_STOP_REASONS: frozenset[str] = frozenset({"error", "parse_error"})
|
||||
INFRA_STOP_REASONS: frozenset[str] = frozenset({"error", "parse_error"})
|
||||
"""执行/解析层失败导致排除的 stop_reason 集合。"""
|
||||
|
||||
|
||||
@@ -2007,7 +2007,7 @@ def _count_infra_excluded(
|
||||
qids = [
|
||||
row["question_id"]
|
||||
for row in prediction_rows
|
||||
if row.get("stop_reason") in _INFRA_STOP_REASONS
|
||||
if row.get("stop_reason") in INFRA_STOP_REASONS
|
||||
]
|
||||
return len(qids), qids
|
||||
|
||||
@@ -2083,7 +2083,7 @@ async def run_diagnosis(
|
||||
|
||||
for row in all_predictions:
|
||||
stop_reason = row.get("stop_reason")
|
||||
if stop_reason in _INFRA_STOP_REASONS:
|
||||
if stop_reason in INFRA_STOP_REASONS:
|
||||
continue
|
||||
if task_type_filter and row.get("task_type") not in task_type_filter:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user