A model evaluation tool
Project description
Newberry Metrics
A Python package for tracking and estimating AI model token costs and usage metrics.
Latest Version: 0.0.10
Features
Cost Tracking and Estimation
- Model cost calculation per million tokens
- Prompt cost estimation
- Session-based cost tracking
- Support for multiple AI models:
- Claude 3.7 Sonnet
- Nova Micro
Installation
pip install newberry_metrics
Usage Examples
Calculate Model Cost
from newberry_metrics import model_cost
# Get cost per million tokens for Nova Micro
nova_cost = model_cost("nova micro")
print(f"Nova Micro cost per million tokens: ${nova_cost}")
# Get cost for Claude 3.7 Sonnet
claude_cost = model_cost("claude 3.7 sonnet")
print(f"Claude 3.7 Sonnet cost per million tokens: ${claude_cost}")
Estimate Prompt Cost
from newberry_metrics import prompt_cost
prompt = "What is the weather in San Francisco?"
cost = prompt_cost(prompt, model="nova micro")
print(f"Estimated prompt cost: ${cost}")
Track Session Costs
from newberry_metrics import session_cost
# Track costs across multiple prompts in a session
session_id = "session_1"
cost1 = session_cost(session_id, "First prompt", model="nova micro")
cost2 = session_cost(session_id, "Second prompt", model="nova micro")
print(f"Total session cost: ${cost2}") # Shows cumulative cost
Technical Details
Token Estimation
- Uses a simple 4 characters per token estimation rule
- Provides conservative estimates for cost calculation
- Supports both input and output token cost calculation
Recent Updates (v0.0.10)
New Features
- Implemented basic token cost estimation
- Added support for Claude 3.7 Sonnet and Nova Micro models
- Introduced session-based cost tracking
- Added utility functions for cost estimation
Technical Improvements
- Simple token estimation algorithm
- Session cost persistence during runtime
- Model pricing configuration system
Requirements
- Python >= 3.10
Contact & Support
- Developer: Satya-Holbox, Harshika-Holbox
- Email: satyanarayan@holbox.ai
- GitHub: SatyaTheG
License
This project is licensed under the MIT License.
Note: This package is actively maintained and regularly updated with new features and model support.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file newberry_metrics-0.0.30.tar.gz.
File metadata
- Download URL: newberry_metrics-0.0.30.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7c358b8287ec6787f5c3d84c091fcc3a4cba5bc45436c499d154636c17ffa56
|
|
| MD5 |
ef23a8ce9fa34df06a173b4409025673
|
|
| BLAKE2b-256 |
1f0cf4680b96c3d9472b4e214e9b5446ea0a2b20b27aab3a2d8f4a0c4b0bf283
|
File details
Details for the file newberry_metrics-0.0.30-py3-none-any.whl.
File metadata
- Download URL: newberry_metrics-0.0.30-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f21b39559d108b652a2e69ff5f2b9b77dce482150279789e60b3ba09530ed370
|
|
| MD5 |
bfc3ff13ab0d61377cc2d6e3cb4f2013
|
|
| BLAKE2b-256 |
fdb2af8ec0a3daf8a4cd0a1874ddd665d85710058ef9b3e522ebe05c24957f32
|