diff --git a/cli.py b/cli.py new file mode 100644 index 0000000..e9f50be --- /dev/null +++ b/cli.py @@ -0,0 +1,19 @@ +import sys +from agent import executor + +if __name__ == "__main__": + print("RAG Agent CLI. Commands: /add <file>, /search <query>, /quit") + while True: + line = input("> ") + if line.startswith("/quit"): + break + if line.startswith("/add"): + _, title, file = line.split(maxsplit=2) + with open(file, "r", encoding="utf-8") as f: + text = f.read() + print(executor.invoke({"input": f"add {title} {text}"})) + elif line.startswith("/search"): + _, query = line.split(maxsplit=1) + print(executor.invoke({"input": f"search {query}"})) + else: + print("Unknown command")