sync from accepted repo: main.py

This commit is contained in:
2026-05-27 12:36:21 +00:00
parent 6783e0eba7
commit 1ae4328896
+1 -8
View File
@@ -1,14 +1,9 @@
"""Интерактивный RAG-агент (Qdrant + Ollama + LangChain)."""
from __future__ import annotations
try:
from agent_app import build_agent, build_llm
from knowledge_base import build_knowledge_base
from rag_tools import add_to_knowledge_base, get_knowledge_base, search_knowledge_base
except ModuleNotFoundError:
from .agent_app import build_agent, build_llm
from .knowledge_base import build_knowledge_base
from .rag_tools import add_to_knowledge_base, get_knowledge_base, search_knowledge_base
__all__ = [
"build_agent",
@@ -50,9 +45,7 @@ def run_interactive_cli() -> None:
print(add_to_knowledge_base.invoke({"content": content, "title": title}))
continue
result = agent.invoke(
{"messages": [{"role": "human", "content": user_input}]}
)
result = agent.invoke({"messages": [{"role": "human", "content": user_input}]})
answer = result["messages"][-1]
print(f"\nАгент: {getattr(answer, 'content', answer)}\n")