From 1f9b9cfbf2764628418d7ce8008afd9997e684d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 2 Jun 2026 07:24:10 +0000 Subject: [PATCH] Update main.py --- main.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 70077de..092db74 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,25 @@ -# Entry point – simply imports and runs the agent. +"""Entry point for the RAG agent. -from agent import main +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__": - 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