Роутер работает нормально в process v2

This commit is contained in:
2026-04-07 14:09:51 +03:00
parent 0a25e42ea1
commit 8b7b72967e
1746 changed files with 216414 additions and 14037 deletions
@@ -80,6 +80,7 @@ class CaseDirectoryLoader:
pipeline = dict(raw.get("pipeline") or {})
return CaseExpectations(
router=RouterExpectation(
domain=str(router.get("domain") or "").strip() or None,
intent=str(router.get("intent") or "").strip() or None,
sub_intent=str(router.get("sub_intent") or "").strip() or None,
graph_id=str(router.get("graph_id") or "").strip() or None,
@@ -114,4 +115,6 @@ class CaseDirectoryLoader:
def _normalize_runner(self, value: str) -> str:
if value in {"agent_runtime", "runtime", "code_qa_eval"}:
return "agent_runtime"
if value in {"process_v2", "v2_process", "v2"}:
return "process_v2"
return value
+2 -1
View File
@@ -5,7 +5,7 @@ from pathlib import Path
from typing import Literal
RunnerKind = Literal["agent_runtime"]
RunnerKind = Literal["agent_runtime", "process_v2"]
ModeKind = Literal["router_only", "router_rag", "full_chain"]
@@ -18,6 +18,7 @@ class CaseInput:
@dataclass(slots=True, frozen=True)
class RouterExpectation:
domain: str | None = None
intent: str | None = None
sub_intent: str | None = None
graph_id: str | None = None
+14 -3
View File
@@ -19,10 +19,12 @@ class V3Runner:
*,
pipeline_mode: str = "full",
router_llm_mode: str = "deterministic",
workflow_llm_enabled: bool = True,
) -> None:
self._cases_dir = cases_dir
self._pipeline_mode = pipeline_mode
self._router_llm_mode = router_llm_mode
self._workflow_llm_enabled = workflow_llm_enabled
self._validator = CaseValidator()
self._sessions = RagSessionProvider()
self._agent_runtime = None
@@ -50,9 +52,11 @@ class V3Runner:
return results, self._writer.write_summary(results)
def _execute(self, case, rag_session_id):
if case.runner != "agent_runtime":
raise ValueError(f"Unsupported runner: {case.runner}")
return self._agent_runtime_adapter().execute(case, rag_session_id)
if case.runner == "agent_runtime":
return self._agent_runtime_adapter().execute(case, rag_session_id)
if case.runner == "process_v2":
return self._v2_process_adapter().execute(case, rag_session_id)
raise ValueError(f"Unsupported runner: {case.runner}")
def _agent_runtime_adapter(self):
if self._agent_runtime is None:
@@ -63,3 +67,10 @@ class V3Runner:
router_llm_mode=self._router_llm_mode,
)
return self._agent_runtime
def _v2_process_adapter(self):
if not hasattr(self, "_v2_process"):
from tests.pipeline_setup_v3.runtime.v2_process_adapter import V2ProcessAdapter
self._v2_process = V2ProcessAdapter(workflow_llm_enabled=self._workflow_llm_enabled)
return self._v2_process
@@ -24,7 +24,7 @@ class RagSessionProvider:
return self._cache[key]
def _build_indexer(self):
from app.modules.rag.persistence.repository import RagRepository
from app.core.rag.persistence.repository import RagRepository
from tests.pipeline_setup_v3.shared.rag_indexer import RagSessionIndexer
if self._repository is None:
@@ -6,6 +6,7 @@ from tests.pipeline_setup_v3.core.models import V3Case
class CaseValidator:
def validate(self, case: V3Case, actual: dict, details: dict | None = None) -> list[str]:
mismatches: list[str] = []
self._check(case.expectations.router.domain, actual.get("domain"), "domain", mismatches)
self._check(case.expectations.router.intent, actual.get("intent"), "intent", mismatches)
self._check(case.expectations.router.sub_intent, actual.get("sub_intent"), "sub_intent", mismatches)
self._check(case.expectations.router.graph_id, actual.get("graph_id"), "graph_id", mismatches)