Решение готово к публикации: add main.py
This commit is contained in:
@@ -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("RAG‑Agent 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!")
|
||||
Reference in New Issue
Block a user