Skip to content

Main task: The Agent utilizes the Wolfram Alpha API to obtain answers, then generates explanations based on the questions and answers, storing both the explanations in ChromaDB and saving associated images for faster future retrieval

License

Notifications You must be signed in to change notification settings

Katashynskyi/math_tutor_agent_ua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Tutor Agent: Development Summary

📋 Chain of thought | Fun facts:

  • Leaked API key doesn't work anymore, generate yours on developer.wolframalpha.com

  • I created an Agent with 2 tools: tool 1 - checks if a query is about math, and the 2nd is just a whole logic of math tutoring.

  • Streamlit frontend, just open an .ipynb file and use it straight in browser. LINK to the video example!

  • I use Gemma 2 9B instruct because it can generate Ukrainian quite well.

  • The ChromaDB dataset doesn't even exist, but if you asked the agent the same question - it'll create a brand new database and give you back a previously saved answer. (for generation of more robust answers we can use a bigger model, but even the current one is great at math questions (though it can't solve image input))

    image

  • My goal was to use the small 3B Llama 3.1 for agent logic and use Gemma 2 9B for explanation (now it's Gemma 2 9B instruct for both)

  • For equations, I use the Wolfram Simple API.

  • I was planning to add a button to tasks generation on the sidebar (but didn't make it yet)

  • I was planning to generate ZNO questions for ChromaDB + Image library (but didn't make it). The problem is with understanding images by LLMs and image generation for the answer.

  • Validation of dataset isn't working without a dataset, because it's not a RAG but an Agent without a default dataset.

  • I've planned to save questions, answers with explanation[s] and with pictures, and I made it.

  • I use Ollama instead of vLLM because I'm working on a laptop with 4GB GPU AND I want to use as models as small as possible to understand how to use them properly.

📋 Overview

The project represents an intelligent system for solving mathematical problems using a combination of modern technologies and approaches.

✅ Implemented Components

1. Core Infrastructure

  • Wolfram Alpha integration for precise calculations
  • Result caching system using ChromaDB
  • Bilingual support (Ukrainian/English)
  • Web interface based on Streamlit

2. Problem Processing

  • Automatic mathematical problem type detection
  • Step-by-step explanation generation
  • Result visualization through graphs and diagrams
  • Solution storage and reuse

3. System Reliability

  • User input validation
  • Error handling at all levels
  • Fallback mechanism for local calculations
  • API key and connection verification

🔄 Technology Stack

  • Core Components:

    • Wolfram Alpha API
    • ChromaDB
    • Streamlit
    • Ollama
    • Google Translator
  • Supporting Tools:

    • PIL for image processing
    • JSON for data structuring
    • Requests for API calls

📈 Potential Improvements

1. Functionality Extension

  • Implementation of task generator
  • Addition of evaluation system
  • Development of multi-agent architecture

2. Quality Improvements

  • Knowledge base expansion
  • Enhanced explanations
  • Translation optimization

3. Technical Enhancements

  • Caching optimization
  • Error handling improvements
  • Expanded visualization format support

📊 Conclusions

The project demonstrates good basic functionality for mathematical problem solving but requires further development in task generation and quality assessment. The core system components work reliably and efficiently, providing a solid foundation for future development.

Key Achievements:

  1. Created a working prototype with basic functionality
  2. Implemented a reliable mathematical problem processing system
  3. Provided bilingual support and user-friendly interface

Development Directions:

  1. Implementation of task generation
  2. Development of evaluation system
  3. Realization of multi-agent architecture

💡 Technical Implementation Details

RAG System

  • Uses ChromaDB for efficient storage and retrieval

  • Implements similarity search for cached solutions

    image2

  • Maintains metadata for better search results

Translation Pipeline

  • Bidirectional translation between Ukrainian and English
  • Handles mathematical terminology accurately
  • Preserves formatting during translation

Error Handling

  • Multiple fallback mechanisms
  • Graceful degradation when services are unavailable
  • Comprehensive error messages in Ukrainian

Visualization

  • Dynamic image generation through Wolfram Alpha
  • Local image storage and management
  • Responsive display in web interface

🔍 Code Quality

Strengths

  • Well-structured modular design
  • Comprehensive error handling
  • Clear separation of concerns
  • Type hints and documentation

Areas for Improvement

  • Need for more unit tests
  • Better configuration management
  • Code optimization opportunities
  • Enhanced logging system

📚 Documentation Status

Complete

  • Basic setup instructions
  • API documentation
  • Configuration guide

About

Main task: The Agent utilizes the Wolfram Alpha API to obtain answers, then generates explanations based on the questions and answers, storing both the explanations in ChromaDB and saving associated images for faster future retrieval

Topics

Resources

License

Stars

Watchers

Forks