Skip to main content

Track LLM usage across DSPy program runs

Project description

Nanomon

LLM observability for DSPy applications.

What is Nanomon?

Nanomon is an observability platform for LLM applications built with DSPy. It automatically tracks token usage, costs, and tool calls across your DSPy program runs, giving you full visibility into your AI workflows.

Features

  • Automatic LLM token usage tracking
  • Cost calculation and analytics
  • Tool call tracking with the @nanomon decorator
  • DSPy integration (Predict, ReAct, ChainOfThought)
  • Run context management for grouping related calls
  • Multiple storage backends (API, SQLite)

Quick Start

import dspy
from nanomon import NanomonRunContext, NanomonCallback, configure_nanomon

# 1. Create context
context = NanomonRunContext(default_tags=["production"])

# 2. Configure tool tracking
configure_nanomon(context._sink)

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

# 4. Track runs with NanomonCallback
with context.run(tags=["my-task"], metadata={"version": "1.0"}) as ctx:
    callback = NanomonCallback(ctx)
    dspy.configure(lm=lm, callbacks=[callback])

    # Each DSPy module call is tracked as a separate run
    predictor = dspy.Predict(MySignature)
    result = await predictor.acall(input="Hello")

Note: Use .acall() for async DSPy module calls to ensure proper callback integration.

Links

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.1.tar.gz (16.6 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.1-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanomon-0.2.1.tar.gz
  • Upload date:
  • Size: 16.6 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.1.tar.gz
Algorithm Hash digest
SHA256 3a7cb0e191675ac761be923f233c28f9647c86774f2c30129ba32c65f64958e9
MD5 b6a9ab151fcf61bd085daa95990bd125
BLAKE2b-256 81d9e4d7e90d9342aa15e81c81f5bc8cae042d53e61b0ea13d3891c791ec3ae2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanomon-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8fa891e2a7d0077f4b031808dfbcf45432de5072f67493ee2501b594fc91d03
MD5 6bc810d3dd52637e57b940774bd0229c
BLAKE2b-256 1a1330b49c41ef5d11222d81a4f3ffcf4d4c3768cac6a40fa33326d155b6d863

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