Решение готово к публикации: add main.py

This commit is contained in:
2026-06-11 09:16:15 +00:00
parent 77b6fcd15e
commit 69b409d35d
+20
View File
@@ -0,0 +1,20 @@
"""
Simple chat loop for the RAG agent.
"""
import os
from langchain.agents import AgentExecutor
from agent import agent
# Create executor with memory
executor = AgentExecutor(agent=agent, verbose=True)
print("RAGAgent ready. Type 'exit' to quit.")
while True:
user_input = input("You: ")
if user_input.lower() in {"exit", "quit"}:
break
result = executor.invoke({"input": user_input})
# The agent returns a dict with keys 'output' and possibly tool calls.
print(f"Assistant: {result.get('output', '')}")
print("Goodbye!")