A virtual math professor that provides step-by-step solutions to mathematical problems using an Agentic RAG (Retrieval-Augmented Generation) architecture, with human feedback for continuous improvement.
Deployed Agent at https://bcwti9cmjtjgovljrdxxer.streamlit.app/
Documentation at https://sarthakb11.github.io/math-homework-helper/
The system uses an Agentic RAG architecture with the following components:
math-homework-helper/
โโโ app.py # Main Streamlit app entry point
โโโ requirements.txt # Python dependencies
โโโ env.sample # Example environment variables
โโโ .env # (Not committed) Your actual environment variables
โโโ app/ # Core application modules (agents, kb, feedback, etc.)
โโโ scripts/
โ โโโ init_db.py # Script to initialize the vector DB
โ โโโ load_knowledge_base.py # Script to load sample data
โโโ .github/workflows/
โ โโโ deploy.yml # GitHub Actions workflow for deployment
โโโ ...
git clone https://github.com/your-username/math-homework-helper.git
cd math-homework-helper
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements.txt
cp env.sample .env
Edit .env with your API keys and configuration.
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
python scripts/init_db.py
python scripts/load_knowledge_base.py
streamlit run app.py
A ready-to-use GitHub Actions workflow is provided at .github/workflows/deploy.yml. On push to main, it will:
To use Qdrant Cloud, set VECTOR_DB_URL and VECTOR_DB_API_KEY in your .env or as GitHub Actions secrets.
Set these secrets in your GitHub repository (Settings โ Secrets and variables โ Actions):
LLM_API_KEYSEARCH_API_KEYVECTOR_DB_URLVECTOR_DB_PORTVECTOR_DB_COLLECTIONDB_CONNECTION_STRINGDEBUGLOG_LEVEL(Reference your .env.sample for any additional secrets your app may require.)
See env.sample for all required environment variables:
LLM_API_KEYVECTOR_DB_URLVECTOR_DB_PORTVECTOR_DB_COLLECTIONSEARCH_API_KEYDB_CONNECTION_STRINGDEBUGLOG_LEVELTo run tests:
pytest
maths-homework-helper/
โโโ app/ # Core application code
โ โโโ agents/ # Agent definitions and logic
โ โ โโโ generation_agent.py # LLM-based solution generation
โ โ โโโ routing_agent.py # KB/Web routing logic
โ โโโ gateway/ # AI Gateway implementation
โ โ โโโ ai_gateway.py # Input/output validation
โ โโโ kb/ # Knowledge Base integration
โ โ โโโ vector_db.py # Vector database connector
โ โโโ web_search/ # Web Search and extraction logic
โ โ โโโ search_agent.py # Web search and content extraction
โ โโโ feedback/ # Human-in-the-Loop feedback mechanism
โ โ โโโ feedback_loop.py # Feedback collection and processing
โ โโโ models/ # Data models and schemas
โ โโโ database.py # Database models
โโโ scripts/ # Utility scripts
โ โโโ init_db.py # Initialize database tables
โ โโโ load_knowledge_base.py # Load sample data into KB
โโโ data/ # Knowledge Base data and schemas
โ โโโ kb_data/ # Custom KB data files
โ โโโ feedback_logs/ # Feedback logs
โโโ Instructions/ # Project documentation
โโโ .env # Environment variables (not versioned)
โโโ env.sample # Sample environment variables
โโโ requirements.txt # Python dependencies
โโโ app.py # Main application entry point
We welcome contributions! Please see the development workflow in the documentation folder.
This project is licensed under the MIT License.