0

๐Ÿง  Math Tutor Agent โ€“ Agentic RAG with Feedback Loop

awesome-llm-appsagentic_rag_math_agent

This project implements an Agentic-RAG architecture to simulate a math professor that solves JEE-level math questions with step-by-step explanations. The system smartly routes queries between a vector database and web search, applies input/output guardrails, and incorporates human feedback for conti

Sign in to save downloads to your library and vote.

Preview

๐Ÿง  Math Tutor Agent โ€“ Agentic RAG with Feedback Loop

This project implements an Agentic-RAG architecture to simulate a math professor that solves JEE-level math questions with step-by-step explanations. The system smartly routes queries between a vector database and web search, applies input/output guardrails, and incorporates human feedback for continuous learning.

๐Ÿ“Œ Features

  • โœ… Input Guardrails (DSPy): Accepts only academic math questions.
  • ๐Ÿ“š Knowledge Base Search: Uses Qdrant Vector DB with OpenAI Embeddings to match known questions.
  • ๐ŸŒ Web Fallback: Integrates Tavily API when no good match is found.
  • โœ๏ธ GPT-4.1 Explanations: Generates step-by-step math solutions.
  • ๐Ÿ›ก๏ธ Output Guardrails: Filters for correctness and safety.
  • ๐Ÿ‘ Human-in-the-Loop Feedback: Users rate answers (Yes/No), logged for future learning.
  • ๐Ÿ“Š Benchmarking: Evaluated on JEEBench dataset with adjustable question limits.
  • ๐Ÿ’ป Streamlit UI: Interactive dashboard with multiple tabs.

๐Ÿš€ Architecture Flow

<img width="465" alt="Screenshot 2025-05-04 at 3 45 58โ€ฏPM" src="https://github.com/user-attachments/assets/c0a9e612-2ef0-413c-b779-c99fe9f48619" />

๐Ÿ“š Knowledge Base

  • Dataset: JEEBench (HuggingFace)
  • Vector DB: Qdrant (with OpenAI Embeddings)
  • Storage: Built with llama-index to persist embeddings and perform top-1 similarity search

๐ŸŒ Web Search

  • Uses Tavily API for fallback search when the KB doesn't contain a good match
  • Fetched content is piped into GPT-4o for clean explanation

๐Ÿ” Guardrails

  • Input Guardrail (DSPy): Accepts only math-related academic questions
  • Output Guardrail (DSPy): Blocks hallucinated or off-topic content

๐Ÿ‘จโ€๐Ÿซ Human-in-the-Loop Feedback

  • Streamlit UI allows students to give ๐Ÿ‘ / ๐Ÿ‘Ž after seeing the answer
  • Feedback is logged to a local JSON file for future improvement

๐Ÿ“Š Benchmarking

  • Evaluated on 50 random JEEBench Math Questions
  • Current Accuracy: 66%
  • Benchmark results saved to: benchmark/results.csv

๐Ÿš€ Demo

To run the app with Streamlit:

streamlit run app/streamlit.py




Ingestion metadata

Source catalog
awesome-llm-apps
Repository
Shubhamsaboo/awesome-llm-apps ยท main
File path
rag_tutorials/agentic_rag_math_agent/README.md
Last refreshed
7/23/2026, 10:39:09 PM (4h ago)
Refresh schedule
Daily ยท 03:00 UTC
Dedupe status
Unique ยท deduped by (source, url)