Easy Calc Tool
🚀 A flexible calculation toolbox designed specifically for LLM Function Calling
✨ Features
- 🎯 LLM-Optimized: Natural language parameter parsing, making it easier for LLMs to call
- 📊 All-in-One: Basic arithmetic, statistical analysis, time series, unit conversion, and more
- 🔌 LangChain Ready: Out-of-the-box LangChain tool integration
- 🛡️ Secure: Safe expression evaluation, preventing injection attacks
- 📦 Lightweight: Core dependencies only (pandas, numpy)
- 🚀 High Performance: Built-in caching, batch computation support
- 🌍 Multi-format Support: CSV, JSON, DataFrame, file paths
📦 Installation
# Basic installation
pip install easy-calc-tool
# With LangChain support
pip install easy-calc-tool[langchain]
# Full installation (includes development tools)
pip install easy-calc-tool[all]
🚀 Quick Start
Basic Usage
from easy_calc_tool import EasyCalc
calc = EasyCalc()
# 基础算术
result = calc.calculate("arithmetic", None, expression="100 * 2 + 5")
print(result["result"]) # 205
# 统计分析
data = [
{"sales": 100, "profit": 20},
{"sales": 200, "profit": 40},
{"sales": 300, "profit": 60}
]
result = calc.calculate("statistics", data, columns="sales", operations=["sum", "mean"])
print(result["statistics"]["sales"]["sum"]) # 600
Natural Language Interface
# Natural language aggregation
result = calc.calculate("aggregate", data,
what="group by profit and sum sales")
print(result["grouped_result"])
🛠️ LangChain Integration
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from easy_calc_tool.langchain import get_tools
llm = ChatOpenAI(model="gpt-4")
tools = get_tools() # 一键获取所有工具
agent = create_agent(model=llm, tools=tools)
response = agent.invoke({
"messages": [{"role": "user", "content": "计算 12345 * 67890"}]
})
📚 Supported Scenarios
- Basic Calculations
- Arithmetic operations (+, -, *, /, **, %)
- Trigonometric functions (sin, cos, tan)
- Logarithmic and exponential functions
- Percentage calculations
- Rounding operations
- Statistical Analysis
-
Descriptive statistics (mean, median, mode, std, var)
-
Group statistics (GroupBy operations)
-
Correlation analysis
-
Regression analysis
-
Hypothesis testing
- Data Processing
-
Aggregation (sum, mean, count, min, max)
-
Data filtering
-
Pivot tables
-
Data transformation (normalization, standardization)
- Time Series
-
Moving averages
-
Growth rates (MoM, YoY)
-
Cumulative sums
-
Lag/Difference operations
-
Date arithmetic
- Other Features
-
Unit conversion (length, weight, temperature, currency)
-
Date calculations (age, date differences)
-
Financial calculations (loans, IRR, NPV)
-
Matrix operations
🔧 Configuration
from easy_calc_tool import EasyCalc
# Custom configuration
calc = EasyCalc(config={
"cache_enabled": True, # Enable result caching
"precision": 2, # Floating point precision
"timeout": 30, # Computation timeout (seconds)
"max_data_size": 1000000, # Maximum data rows
"safe_mode": True, # Enable safe evaluation mode
})
📖 Documentation
Full documentation is available at https://easy-calc-tool.readthedocs.io
-
Installation Guide
-
Usage Examples
-
API Reference
-
Contributing Guide
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone the repository
git clone https://github.com/easy-calc-tool/easy-calc-tool.git
cd easy-calc-tool
# Install development dependencies
make install-dev
# Run tests
make test
# Run linting
make lint
# Format code
make format
📊 Benchmarks
| Operation | Data Size | Time |
|---|---|---|
| Basic arithmetic | N/A | < 0.1ms |
| Statistics (mean, sum) | 1M rows | ~50ms |
| Group by aggregation | 1M rows, 10 groups | ~100ms |
| Time series (moving average) | 100K rows | ~30ms |
🗺️ Roadmap
-
v0.2.0 - More statistical functions (ANOVA, chi-square)
-
v0.3.0 - Machine learning predictions
-
v0.4.0 - Visualization support
-
v0.5.0 - GPU acceleration
-
v1.0.0 - Stable release with full documentation
🙏 Acknowledgments
-
Built with pandas and numpy
-
Inspired by the needs of LLM function calling applications
-
Thanks to all contributors and users
📄 License
MIT License - see LICENSE file for details.
📧 Contact
Issues: GitHub Issues
Email: team@easy-calc-tool.com
Discord: Join our Discord
Metadata
Release files for easy-calc-tool 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easy_calc_tool-0.1.4.tar.gz | 49.6 kB | Without provenance | Details for easy_calc_tool-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easy_calc_tool-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for easy_calc_tool-0.1.4-py3-none-any.whl |
Total release size: 77.7 kB
Release files / easy_calc_tool-0.1.4.tar.gz
| Download URL | easy_calc_tool-0.1.4.tar.gz |
|---|---|
| Size | 49.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51100ae04c2eb499a530dfd2eda88ddf2c67c277aa3d5ddcbc4c1f9b4ad75439
|
|
BLAKE2b-256 checksum How to use checksums |
6694f485cc7c1e8e5188c0ff6a1c3e25dfd44e42dad012c5c00a314a33332df3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / easy_calc_tool-0.1.4-py3-none-any.whl
| Download URL | easy_calc_tool-0.1.4-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc6ebf646af9253afe0b303ae0be50b1dd206448cb2d0026b6916525c600166e
|
|
BLAKE2b-256 checksum How to use checksums |
69dd3be2151e63dcaa7e02a6a07c9080ef6534ff7826a2b8c0937c27e353ea41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for easy-calc-tool 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.