21 lines
557 B
Python
21 lines
557 B
Python
"""
|
||
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!")
|