Update main.py

This commit is contained in:
2026-06-02 07:24:10 +00:00
parent 6bb98d9195
commit 1f9b9cfbf2
+22 -3
View File
@@ -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