MathSolver is an advanced problem-solving tool that leverages Large Language Models (LLMs) with multiple strategies to solve mathematical problems. It supports various solving methods and integrates with popular LLM providers.
COMING SOON
-
Multiple Solving Strategies:
- Direct solving
- Divide-and-conquer approach
- Graph-based problem decomposition
-
LLM Provider Support:
- OpenAI
- Replicate
- Ollama (local models)
-
Evaluation Framework:
- Benchmarking system
- Accuracy metrics
- Solution iteration tracking
-
Flexible Integration:
- Command-line interface (CLI)
- Python API
- Configurable providers
git clone https://github.com/JasonHonKL/mathsolver
cd mathsolver
pip install -e .
Currently it is not availbe in pypi but will be available soon
mathsolver config --provider openai --api-key YOUR_API_KEY --model your-model
mathsolver solve --problem "What is the integral of x^2 from 0 to 3?" --method divide-conquer
mathsolver benchmark --benchmark-file problems.json --output-file results.json
from mathsolver import OpenAIProvider, DivideConquerSolver
# Initialize provider and solver
provider = OpenAIProvider(api_key="your_api_key")
solver = DivideConquerSolver(provider, max_iterations=5)
# Solve a problem
solution = solver.solve("Solve 3x + 2 = 14")
print(f"Answer: {solution['final_answer']}")
print(f"Iterations: {solution['iterations']}")
print(f"Subquestions: {solution['subquestions']}")
mathsolver config \
--provider ollama \
--base-url http://localhost:11434 \
--model llama2
Supported configuration options: - Provider type (openai|replicate|ollama) - API keys - Model selection - Base URLs for custom deployments
Run benchamrks with
mathsolver benchmark --benchmark-file math_problems.json --output-file results.json
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.