An intelligent AI-Powered Math Tutor that delivers clear, step-by-step solutions to mathematical problems. Built with Streamlit for an intuitive and interactive interface, it integrates LangChain for seamless LLM workflows, leverages LangSmith for advanced observability and tracing, and ensures reliability with Pydantic’s type-safe data models.
- Step-by-Step Solutions: Get detailed, educational solutions to math problems with clear explanations
- Interactive Web Interface: Clean, user-friendly Streamlit-based UI with modern design
- LangChain Integration: Built on LangChain for robust AI application development
- LangSmith Observability: Advanced tracing and monitoring with LangSmith for debugging and optimization
- Type Safety with Structured Outputs: Pydantic models ensure data validation, type checking, and structured outputs for supported llms.
- UV Dependency Management: Utilizes UV for efficient and fast dependency resolution and management.
- Sample Problems: Try pre-loaded example problems to get started quickly
- Python 3.11 or higher
- OpenAI API key
- UV package manager
- LangSmith is optional. Without it, tracing will be disabled but the core tutor works fine
git clone https://github.com/ysskrishna/ai-math-tutor.git
cd ai-math-tutor# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install project dependencies
uv sync- Visit OpenAI Platform
- Sign in to your OpenAI account (or create one if you don't have it)
- Click "Create new secret key"
- Copy the generated API key
Create a .env file in the project root. Use .env.sample as a reference:
OPENAI_API_KEY=your_openai_api_key_hereNote: Check
.env.samplefor the complete list of environment variables and their descriptions.
uv run streamlit run main.pyVisit http://localhost:8501
ai-math-tutor/
├── ai/ # AI analysis logic
│ ├── client.py # OpenAI client configuration
│ ├── prompts.py # Prompt templates for tutoring logic
│ └── tutor.py # Main tutoring logic
├── core/ # Core application logic
│ ├── config.py # Configuration and environment setup
│ └── models.py # Pydantic models for structured output
├── media/ # Screenshots and assets
├── .env.sample # Environment variables template
├── main.py # Main Streamlit application
├── pyproject.toml # Project configuration and dependencies
└── README.md # This file
- LangSmith Documentation - Official documentation for observability and tracing
- LangSmith Tracing Guide - Learn how to trace your LLM applications
- LangChain Documentation - Comprehensive guide to LangChain
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is released under the MIT License. See LICENSE for details.
Y. Siva Sai Krishna (@ysskrishna)
Built with ❤️ to make math easier to understand.


