Files
task-6a1864f78a94f887e50d46da/main.py
T
2026-06-02 07:24:10 +00:00

26 lines
810 B
Python

"""Entry point for the RAG agent.
Running ``python main.py`` starts a simple CLI that accepts user queries and
prints the agent's answer along with the source.
"""
from agent import create_agent, create_vectorstore
from vectorstore import load_documents
if __name__ == "__main__":
# Load or create the vector store
store = create_vectorstore()
if not store.get_index_info():
load_documents("documents", store)
agent = create_agent()
print("RAG Agent ready. Type 'exit' to quit.")
while True:
try:
query = input("\nЗапрос: ")
except EOFError:
break
if query.strip().lower() in {"exit", "quit"}:
break
result = agent.invoke({"input": query})
print("Ответ:", result["output"]) # noqa: T201