Track LLM costs and usage across DSPy program runs
Project description
Nanomon
Track LLM costs and usage across DSPy program runs.
Installation
pip install nanomon
Quick Start
import dspy
from nanomon import RunLogger, track_tool
from nanomon.sinks import ApiSink
from nanomon.pricing import JsonPricing
# Setup pricing and sink
pricing = JsonPricing("pricing.json")
sink = ApiSink("http://localhost:8000/api/v1")
# Create logger
logger = RunLogger(pricing=pricing, sink=sink, default_tags=["production"])
# Instrument your LM
lm = dspy.LM(model="gpt-4o-mini")
dspy.settings.configure(lm=logger.instrument_lm(lm))
# Track runs
with logger.run(tags=["experiment-1"], metadata={"dataset": "qa"}):
result = await logger.react(my_module, question="What is 2+2?")
Features
- Track LLM token usage and costs
- Support for multiple sinks (API, SQLite, Multi)
- Tool call tracking with
@track_tooldecorator - DSPy module integration (ReAct, Predict, ChainOfThought)
License
MIT
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
nanomon-0.1.0.tar.gz
(17.1 kB
view details)
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
nanomon-0.1.0-py3-none-any.whl
(24.6 kB
view details)
File details
Details for the file nanomon-0.1.0.tar.gz.
File metadata
- Download URL: nanomon-0.1.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf45441e61d2639ec098e3434db8f4f9b507b4ed309c4ab22e29a2a8ab93537c
|
|
| MD5 |
82b781eb5f08d154cbfbebee12347e62
|
|
| BLAKE2b-256 |
4c19a413ad7060abd72d0d540f35fb588a04450ececafdc754cbf74a442c8a76
|
File details
Details for the file nanomon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nanomon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f1080ac2e85494866f220009acf409010e4114afc1609512ec8d33cfedf84a0
|
|
| MD5 |
8ee4748d938af8f0fab364dcbc09eb78
|
|
| BLAKE2b-256 |
53a0078c96e51adad5b9c533086f0650a5631f2593abfbd4bf1fd076c8d33c30
|