Overview
This guide shows you how to integrate Latitude Telemetry into a program built with DSPy. DSPy has no dedicated instrumentor — it routes every language-model call through LiteLLM. Instrumenting LiteLLM therefore captures all of DSPy’s model calls, including those issued by modules likePredict and ReAct.
You’ll keep writing DSPy modules exactly as you do today. Telemetry observes
the model calls DSPy makes under the hood.
DSPy instrumentation is available in the Python SDK only, via the LiteLLM
integration.
Requirements
- A Latitude account and API key
- A Latitude project slug
- A project that uses DSPy (
dspy, which depends onlitellm) - A key for whichever provider your
dspy.LMtargets (e.g.OPENAI_API_KEY)
Steps
Seeing Your Traces
Once connected, traces appear automatically in Latitude:- Open your project in the Latitude dashboard
- Each execution shows input/output messages, model, token usage, latency, and errors
- Wrap a request with
capture()to group every model call DSPy makes into one trace