Роутер работает нормально в process v2
This commit is contained in:
@@ -2,13 +2,12 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from app.modules.agent.intent_router_v2.factory import GigaChatIntentRouterFactory
|
||||
from app.modules.shared.env_loader import load_workspace_env
|
||||
from app.core.agent.intent_router.factory import GigaChatIntentRouterFactory
|
||||
from app.core.shared.config import load_workspace_env
|
||||
from tests.unit_tests.rag.asserts_intent_router import (
|
||||
assert_domains,
|
||||
assert_file_only_scope,
|
||||
assert_intent,
|
||||
assert_test_policy,
|
||||
assert_path_scope,
|
||||
)
|
||||
from tests.unit_tests.rag.intent_router_testkit import run_sequence
|
||||
|
||||
@@ -29,7 +28,7 @@ def test_e2e_path_carryover_flow() -> None:
|
||||
]
|
||||
)
|
||||
|
||||
assert_file_only_scope(first, "app/core/config.py")
|
||||
assert_path_scope(first, "app/core/config.py", "app/core")
|
||||
assert "app/core/config.py" in second.retrieval_spec.filters.path_scope
|
||||
assert "app/core/config.py" in third.retrieval_spec.filters.path_scope
|
||||
second_file_anchors = [anchor.value for anchor in second.query_plan.anchors if anchor.type == "FILE_PATH" and anchor.source == "conversation_state"]
|
||||
@@ -39,7 +38,10 @@ def test_e2e_path_carryover_flow() -> None:
|
||||
assert any(anchor.type == "FILE_PATH" and anchor.source == "conversation_state" and anchor.span is None for anchor in third.query_plan.anchors)
|
||||
carried_symbols = [anchor.value for anchor in third.query_plan.anchors if anchor.type == "SYMBOL" and anchor.source == "conversation_state"]
|
||||
assert carried_symbols in ([], ["load_config"])
|
||||
assert third.query_plan.sub_intent == "EXPLAIN_LOCAL"
|
||||
assert_intent(first, "GENERAL_QA")
|
||||
assert_intent(second, "GENERAL_QA")
|
||||
assert_intent(third, "GENERAL_QA")
|
||||
assert third.query_plan.sub_intent == "GENERIC_QA"
|
||||
layer_ids = [item.layer_id for item in third.retrieval_spec.layer_queries]
|
||||
assert "C3_ENTRYPOINTS" not in layer_ids
|
||||
|
||||
@@ -52,9 +54,9 @@ def test_e2e_docs_switch_from_code_topic() -> None:
|
||||
]
|
||||
)
|
||||
|
||||
assert_intent(first, "CODE_QA")
|
||||
assert_intent(first, "DOCUMENTATION_EXPLAIN")
|
||||
assert_intent(second, "DOCUMENTATION_EXPLAIN")
|
||||
assert second.conversation_mode == "SWITCH"
|
||||
assert second.conversation_mode == "CONTINUE"
|
||||
assert_domains(second, ["DOCS"])
|
||||
carried = [
|
||||
anchor
|
||||
@@ -75,12 +77,10 @@ def test_e2e_tests_toggle_flow() -> None:
|
||||
]
|
||||
)
|
||||
|
||||
assert_intent(first, "CODE_QA")
|
||||
assert_intent(second, "CODE_QA")
|
||||
assert_test_policy(first, "INCLUDE")
|
||||
assert_test_policy(second, "EXCLUDE")
|
||||
assert first.query_plan.sub_intent == "FIND_TESTS"
|
||||
assert second.query_plan.sub_intent == "EXPLAIN"
|
||||
assert_intent(first, "GENERAL_QA")
|
||||
assert_intent(second, "GENERAL_QA")
|
||||
assert first.query_plan.sub_intent == "GENERIC_QA"
|
||||
assert second.query_plan.sub_intent == "GENERIC_QA"
|
||||
assert "tests" in second.query_plan.negations
|
||||
assert not second.query_plan.expansions
|
||||
assert second.evidence_policy.require_flow is False
|
||||
@@ -94,9 +94,9 @@ def test_e2e_open_file_then_generic_next_steps_is_lightweight() -> None:
|
||||
]
|
||||
)
|
||||
|
||||
assert_file_only_scope(first, "app/core/config.py")
|
||||
assert_file_only_scope(second, "app/core/config.py")
|
||||
assert second.query_plan.sub_intent in {"EXPLAIN_LOCAL", "NEXT_STEPS"}
|
||||
assert_path_scope(first, "app/core/config.py", "app/core")
|
||||
assert_path_scope(second, "app/core/config.py", "app/core")
|
||||
assert second.query_plan.sub_intent == "GENERIC_QA"
|
||||
layer_ids = [item.layer_id for item in second.retrieval_spec.layer_queries]
|
||||
assert "C3_ENTRYPOINTS" not in layer_ids
|
||||
assert second.evidence_policy.require_flow is False
|
||||
@@ -118,9 +118,9 @@ def test_intent_router_live_smoke_path_carryover() -> None:
|
||||
trace_label="intent-router-live",
|
||||
)
|
||||
|
||||
assert_file_only_scope(first, "app/core/config.py")
|
||||
assert_path_scope(first, "app/core/config.py", "app/core")
|
||||
assert "app/core/config.py" in second.retrieval_spec.filters.path_scope
|
||||
assert second.query_plan.sub_intent in {"EXPLAIN_LOCAL", "NEXT_STEPS"}
|
||||
assert second.query_plan.sub_intent == "GENERIC_QA"
|
||||
layer_ids = [item.layer_id for item in second.retrieval_spec.layer_queries]
|
||||
assert "C3_ENTRYPOINTS" not in layer_ids
|
||||
assert second.evidence_policy.require_flow is False
|
||||
|
||||
Reference in New Issue
Block a user