31 lines
977 B
Python
31 lines
977 B
Python
import argparse
|
|
import logging
|
|
|
|
from .agent import RAGAgent
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Educational RAG Agent CLI")
|
|
parser.add_argument("--config", type=str, default="src/config.yaml", help="Path to config file")
|
|
args = parser.parse_args()
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
agent = RAGAgent(config_path=args.config)
|
|
|
|
print("Welcome to the Educational RAG Agent. Type 'exit' to quit.")
|
|
while True:
|
|
try:
|
|
query = input("\nYour question: ").strip()
|
|
if query.lower() in ("exit", "quit"):
|
|
print("Goodbye!")
|
|
break
|
|
if not query:
|
|
print("Please enter a non-empty question.")
|
|
continue
|
|
answer = agent.generate_response(query)
|
|
print(f"\nAnswer:\n{answer}")
|
|
except KeyboardInterrupt:
|
|
print("\nInterrupted. Exiting.")
|
|
break
|
|
|
|
if __name__ == "__main__":
|
|
main() |