Traces
This section shows you how to enable automatic tracing of DSPy calls in Weave. Store traces of language model applications in a central location, both during development and in production. These traces are useful for debugging and as a dataset that helps you improve your application. Weave automatically captures traces for DSPy. To start tracking, callweave.init(project_name="[YOUR-WANDB-PROJECT-NAME]") and use the library as normal. Replace [YOUR-OPENAI-API-KEY] with your OpenAI API key and [YOUR-WANDB-PROJECT-NAME] with your W&B project name.
With tracing enabled, Weave logs every LM call your DSPy program makes to your Weave project, where you can inspect inputs, outputs, and metadata.
Track your own DSPy modules and signatures
Beyond built-in calls, Weave also traces the custom modules and signatures you define. AModule is the building block with learnable parameters for DSPy programs that abstracts a prompting technique. A Signature is a declarative specification of input/output behavior of a DSPy Module. Weave automatically tracks all built-in and custom Signature and Module objects in your DSPy programs. Replace [YOUR-OPENAI-API-KEY] with your OpenAI API key and [YOUR-WANDB-PROJECT-NAME] with your W&B project name.
Optimize and evaluate your DSPy program
Weave also captures traces for DSPy optimizers and evaluation calls, which you can use to improve and evaluate your DSPy program’s performance on a development set. Replace[YOUR-OPENAI-API-KEY] with your OpenAI API key and [YOUR-WANDB-PROJECT-NAME] with your W&B project name.
