Skip to main content

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_tool decorator
  • 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanomon-0.1.0-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

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

Hashes for nanomon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf45441e61d2639ec098e3434db8f4f9b507b4ed309c4ab22e29a2a8ab93537c
MD5 82b781eb5f08d154cbfbebee12347e62
BLAKE2b-256 4c19a413ad7060abd72d0d540f35fb588a04450ececafdc754cbf74a442c8a76

See more details on using hashes here.

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

Hashes for nanomon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f1080ac2e85494866f220009acf409010e4114afc1609512ec8d33cfedf84a0
MD5 8ee4748d938af8f0fab364dcbc09eb78
BLAKE2b-256 53a0078c96e51adad5b9c533086f0650a5631f2593abfbd4bf1fd076c8d33c30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page