Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| from src.edurag_math_bot.config import get_settings | |
| from src.edurag_math_bot.rag_chain import MathRAGAssistant | |
| def main() -> None: | |
| assistant = MathRAGAssistant(settings=get_settings()) | |
| print("MathSutra 12 CLI") | |
| print("Type 'exit' to quit.\n") | |
| while True: | |
| question = input("You: ").strip() | |
| if question.lower() in {"exit", "quit"}: | |
| break | |
| if not question: | |
| continue | |
| result = assistant.answer(question) | |
| print("\nAssistant:\n") | |
| print(result["answer"]) | |
| print("\nSources:") | |
| for source in result["sources"]: | |
| print( | |
| f"- Chapter {source['chapter_number']}: {source['chapter_name']} | " | |
| f"Topic: {source['topic']} | Page: {source['page_number']}" | |
| ) | |
| print() | |
| if __name__ == "__main__": | |
| main() | |