Фикс состояния
This commit is contained in:
1
tests/pipeline_setup/suite_02_pipeline/cli/__init__.py
Normal file
1
tests/pipeline_setup/suite_02_pipeline/cli/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""CLI entrypoints for pipeline test runs and repository reindexing."""
|
||||
36
tests/pipeline_setup/suite_02_pipeline/cli/index_repo.py
Normal file
36
tests/pipeline_setup/suite_02_pipeline/cli/index_repo.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Скрипт индексации репозитория: создаёт RAG-сессию и индексирует указанную директорию.
|
||||
|
||||
Используется для подготовки репозитория перед запуском тестовых пайплайнов с retrieval или full_chain.
|
||||
Запуск из корня проекта (agent):
|
||||
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.index_repo --repo-path /path/to/repo [--project-id ID]
|
||||
|
||||
Параметры:
|
||||
--repo-path (обязательный) Путь к корню индексируемого репозитория.
|
||||
--project-id (опционально) Идентификатор проекта для созданной rag_session; по умолчанию — имя директории репо.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Обеспечиваем импорт из корня проекта
|
||||
_agent_root = Path(__file__).resolve().parents[4]
|
||||
if str(_agent_root) not in sys.path:
|
||||
sys.path.insert(0, str(_agent_root))
|
||||
|
||||
# Добавляем src в путь для app
|
||||
_src = _agent_root / "src"
|
||||
if _src.exists() and str(_src) not in sys.path:
|
||||
sys.path.insert(0, str(_src))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
argv = ["reindex", *sys.argv[1:]]
|
||||
from tests.pipeline_setup.suite_02_pipeline.pipeline_intent_rag.cli import main as cli_main
|
||||
return cli_main(argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
46
tests/pipeline_setup/suite_02_pipeline/cli/run_full_chain.py
Normal file
46
tests/pipeline_setup/suite_02_pipeline/cli/run_full_chain.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Запуск тестового пайплайна «полная цепочка»: intent router + retrieval + LLM.
|
||||
|
||||
Цепочка: intent_router_v2 → RAG retrieval → ответ GigaChat (или другой LLM). Нужны БД и индексированный репозиторий.
|
||||
|
||||
Запуск из корня проекта (agent):
|
||||
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.run_full_chain --rag-session-id <uuid> [--case-id ID ...] [--verbose]
|
||||
|
||||
Или с индексацией перед прогоном:
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.run_full_chain --reindex-repo-path /path/to/repo [--reindex-project-id ID]
|
||||
|
||||
Параметры:
|
||||
--rag-session-id (рекомендуется) UUID RAG-сессии (после индексации через index_repo или run с --reindex-repo-path).
|
||||
--reindex-repo-path Индексировать указанный репозиторий перед прогоном и использовать новую сессию.
|
||||
--reindex-project-id project_id для новой сессии при использовании --reindex-repo-path.
|
||||
--case-id (повторяемый) Запустить только указанные кейсы.
|
||||
--verbose Выводить диагностику по каждому кейсу.
|
||||
--test-name Префикс имени файла с результатами (по умолчанию cli_full_chain).
|
||||
|
||||
Переменные окружения:
|
||||
RUN_INTENT_PIPELINE_FULL_CHAIN=1 — включить маркер full_chain (иначе тесты с этим маркером пропускаются).
|
||||
DATABASE_URL — подключение к БД (обязательно для retrieval).
|
||||
(и переменные для доступа к LLM, см. .env и pipeline_intent_rag/.env.test)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_agent_root = Path(__file__).resolve().parents[4]
|
||||
if str(_agent_root) not in sys.path:
|
||||
sys.path.insert(0, str(_agent_root))
|
||||
_src = _agent_root / "src"
|
||||
if _src.exists() and str(_src) not in sys.path:
|
||||
sys.path.insert(0, str(_src))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
argv = ["run", "--mode", "full_chain", *sys.argv[1:]]
|
||||
from tests.pipeline_setup.suite_02_pipeline.pipeline_intent_rag.cli import main as cli_main
|
||||
return cli_main(argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Запуск тестового пайплайна «только intent router» (без RAG и LLM).
|
||||
|
||||
Цепочка: intent_router_v2 — классификация запроса, без retrieval и ответа LLM.
|
||||
|
||||
Запуск из корня проекта (agent):
|
||||
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.run_router_only [--case-id ID ...] [--verbose]
|
||||
|
||||
Параметры:
|
||||
--case-id (повторяемый) Запустить только указанные кейсы по id. Без указания — все кейсы с тегом router_only.
|
||||
--verbose Выводить диагностику по каждому кейсу.
|
||||
--test-name Префикс имени файла с результатами (по умолчанию cli_router_only).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_agent_root = Path(__file__).resolve().parents[4]
|
||||
if str(_agent_root) not in sys.path:
|
||||
sys.path.insert(0, str(_agent_root))
|
||||
_src = _agent_root / "src"
|
||||
if _src.exists() and str(_src) not in sys.path:
|
||||
sys.path.insert(0, str(_src))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
argv = ["run", "--mode", "router_only", *sys.argv[1:]]
|
||||
from tests.pipeline_setup.suite_02_pipeline.pipeline_intent_rag.cli import main as cli_main
|
||||
return cli_main(argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
45
tests/pipeline_setup/suite_02_pipeline/cli/run_router_rag.py
Normal file
45
tests/pipeline_setup/suite_02_pipeline/cli/run_router_rag.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Запуск тестового пайплайна «intent router + retrieval» (без LLM).
|
||||
|
||||
Цепочка: intent_router_v2 → RAG retrieval. Нужна предварительная индексация репозитория.
|
||||
|
||||
Запуск из корня проекта (agent):
|
||||
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.run_router_rag --rag-session-id <uuid> [--case-id ID ...] [--verbose]
|
||||
|
||||
Или с индексацией перед прогоном:
|
||||
python -m tests.pipeline_setup.suite_02_pipeline.cli.run_router_rag --reindex-repo-path /path/to/repo [--reindex-project-id ID]
|
||||
|
||||
Параметры:
|
||||
--rag-session-id (рекомендуется) UUID RAG-сессии (после индексации через index_repo или run с --reindex-repo-path).
|
||||
--reindex-repo-path Индексировать указанный репозиторий перед прогоном и использовать новую сессию.
|
||||
--reindex-project-id project_id для новой сессии при использовании --reindex-repo-path.
|
||||
--case-id (повторяемый) Запустить только указанные кейсы.
|
||||
--verbose Выводить диагностику по каждому кейсу.
|
||||
--test-name Префикс имени файла с результатами (по умолчанию cli_router_rag).
|
||||
|
||||
Переменные окружения:
|
||||
RUN_INTENT_PIPELINE_ROUTER_RAG=1 — включить маркер router_rag (иначе тесты с этим маркером пропускаются).
|
||||
DATABASE_URL — подключение к БД (обязательно для retrieval).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_agent_root = Path(__file__).resolve().parents[4]
|
||||
if str(_agent_root) not in sys.path:
|
||||
sys.path.insert(0, str(_agent_root))
|
||||
_src = _agent_root / "src"
|
||||
if _src.exists() and str(_src) not in sys.path:
|
||||
sys.path.insert(0, str(_src))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
argv = ["run", "--mode", "router_rag", *sys.argv[1:]]
|
||||
from tests.pipeline_setup.suite_02_pipeline.pipeline_intent_rag.cli import main as cli_main
|
||||
return cli_main(argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user