26 lines
810 B
Python
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
|