Skip to main content

Track LLM usage across DSPy program runs

Project description

Nanomon

Track LLM usage across DSPy program runs.

Installation

pip install nanomon

Quick Start

import dspy
from nanomon import NanomonRunContext

# Create context - that's it! No pricing or sink configuration needed
context = NanomonRunContext(default_tags=["production"])

# Instrument your LM
lm = dspy.LM(model="gpt-4o-mini")
dspy.settings.configure(lm=context.instrument_lm(lm))

# Track runs
with context.run(tags=["experiment-1"], metadata={"dataset": "qa"}):
    result = await context.react(my_module, question="What is 2+2?")

Features

  • Track LLM token usage automatically
  • Automatic cost calculation (handled by backend)
  • Tool call tracking with @track_tool decorator
  • DSPy module integration (ReAct, Predict, ChainOfThought)
  • Zero configuration - just instantiate and go

Tool Tracking

from nanomon import track_tool, configure_tool_tracking

# Configure tool tracking (usually done once at startup)
configure_tool_tracking(context._sink)

@track_tool(name="web_search")
def search_web(query: str) -> str:
    # Your tool implementation
    return results

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.2.0.tar.gz (16.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.2.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file nanomon-0.2.0.tar.gz.

File metadata

  • Download URL: nanomon-0.2.0.tar.gz
  • Upload date:
  • Size: 16.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.2.0.tar.gz
Algorithm Hash digest
SHA256 3efdbbaa1b97bae5a3c20075ca70a908953f931b14dceaaf99dcfe82aad382cd
MD5 2684ed6db6740ff4bd43c7d935e0d45b
BLAKE2b-256 78f86d4f75b73e00d1faf3a1b74a9a6ac96fa91c456c7885b5198449159c986a

See more details on using hashes here.

File details

Details for the file nanomon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nanomon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12bf7b0d3d29de7e1ee7a3e81487b01cdf1a0206d9c9e321a8f4496b11610e35
MD5 488212839761174f91ffd5047539f3f2
BLAKE2b-256 61dd72101682804f257f88e39ca5b170572dfa923f590e179eee4c0b58cae10d

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