| from __future__ import annotations | |
| import argparse | |
| from rag.chain import answer | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Run the FAQ RAG chatbot locally.") | |
| parser.add_argument("question", nargs="?", help="The question to answer from the FAQ knowledge base.") | |
| args = parser.parse_args() | |
| if args.question: | |
| print(answer(args.question)) | |
| return | |
| try: | |
| while True: | |
| q = input("Question (type 'exit' to quit): ").strip() | |
| if not q: | |
| continue | |
| if q.lower() in {"exit", "quit"}: | |
| break | |
| print(answer(q)) | |
| except (KeyboardInterrupt, EOFError): | |
| print("\nGoodbye") | |
| if __name__ == "__main__": | |
| main() | |