Documentation Index
Fetch the complete documentation index at: https://docs.trulayer.ai/llms.txt
Use this file to discover all available pages before exploring further.
Install
Instrument
instrument_dspy is a process-wide patch — call it once at startup.
instrument_dspy(trace) inside the request handler.
What gets captured
- One
llmspan perdspy.Predict.forward()call with the rendered prompt as input and the parsed output fields (e.g.answer) as output. - Token counts, model name, and latency pulled from the underlying
dspy.LMcall. - Errors from the LM or from DSPy’s field parsing surface as
span.status = error.
Disabling
Known gotchas
- Global patch. DSPy doesn’t expose a per-instance hook, so instrumentation patches
dspy.Predict.forwardglobally. Safe to call multiple times — subsequent calls are no-ops. - Compile-time calls are traced too. If you run
dspy.telepromptoptimizers while instrumented, every candidate prompt evaluation shows up as a span. Consider callinguninstrument_dspy()during compilation and re-instrumenting at serve time. - Async. DSPy’s async support is experimental; the current instrumentation is sync-only.