sync from accepted repo: main.py
This commit is contained in:
@@ -1,14 +1,9 @@
|
|||||||
"""Интерактивный RAG-агент (Qdrant + Ollama + LangChain)."""
|
"""Интерактивный RAG-агент (Qdrant + Ollama + LangChain)."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
try:
|
from agent_app import build_agent, build_llm
|
||||||
from agent_app import build_agent, build_llm
|
from knowledge_base import build_knowledge_base
|
||||||
from knowledge_base import build_knowledge_base
|
from rag_tools import add_to_knowledge_base, get_knowledge_base, search_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__ = [
|
__all__ = [
|
||||||
"build_agent",
|
"build_agent",
|
||||||
@@ -50,9 +45,7 @@ def run_interactive_cli() -> None:
|
|||||||
print(add_to_knowledge_base.invoke({"content": content, "title": title}))
|
print(add_to_knowledge_base.invoke({"content": content, "title": title}))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result = agent.invoke(
|
result = agent.invoke({"messages": [{"role": "human", "content": user_input}]})
|
||||||
{"messages": [{"role": "human", "content": user_input}]}
|
|
||||||
)
|
|
||||||
answer = result["messages"][-1]
|
answer = result["messages"][-1]
|
||||||
print(f"\nАгент: {getattr(answer, 'content', answer)}\n")
|
print(f"\nАгент: {getattr(answer, 'content', answer)}\n")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user