Update main.py
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user