Фиксация изменений
This commit is contained in:
25
app/modules/rag/intent_router_v2/local_runner.py
Normal file
25
app/modules/rag/intent_router_v2/local_runner.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from app.modules.rag.intent_router_v2.models import ConversationState, IntentRouterResult, RepoContext
|
||||
from app.modules.rag.intent_router_v2.router import IntentRouterV2
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IntentRouterScenarioRunner:
|
||||
def __init__(self, router: IntentRouterV2) -> None:
|
||||
self._router = router
|
||||
|
||||
def run(self, queries: list[str], repo_context: RepoContext | None = None) -> list[IntentRouterResult]:
|
||||
state = ConversationState()
|
||||
context = repo_context or RepoContext()
|
||||
results: list[IntentRouterResult] = []
|
||||
for index, user_query in enumerate(queries, start=1):
|
||||
LOGGER.warning("intent router local input: turn=%s user_query=%s", index, user_query)
|
||||
result = self._router.route(user_query, state, context)
|
||||
LOGGER.warning("intent router local output: turn=%s result=%s", index, result.model_dump_json(ensure_ascii=False))
|
||||
results.append(result)
|
||||
state = state.advance(result)
|
||||
return results
|
||||
Reference in New Issue
Block a user