dspy-debugging-observability

Solid

This skill should be used when the user asks to "debug DSPy programs", "trace LLM calls", "monitor production DSPy", "use MLflow with DSPy", mentions "inspect_history", "custom callbacks", "observability", "production monitoring", "cost tracking", or needs to debug, trace, and monitor DSPy applications in development and production.

AI & Automation 78 stars 10 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 90/100

Stars 20%
63
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# DSPy Debugging & Observability ## Goal Debug, trace, and monitor DSPy programs using built-in inspection, MLflow tracing, and custom callbacks for production observability. ## When to Use - Debugging unexpected outputs - Understanding multi-step program flow - Production monitoring (cost, latency, errors) - Analyzing optimizer behavior - Tracking LLM API usage ## Related Skills - Optimize programs: [dspy-miprov2-optimizer](../dspy-miprov2-optimizer/SKILL.md) - Evaluate quality: [dspy-evaluation-suite](../dspy-evaluation-suite/SKILL.md) - Build agents: [dspy-react-agent-builder](../dspy-react-agent-builder/SKILL.md) ## Inputs | Input | Type | Description | |-------|------|-------------| | `program` | `dspy.Module` | Program to debug/monitor | | `callback` | `BaseCallback` | Optional custom callback (subclass of `dspy.utils.callback.BaseCallback`) | ## Outputs | Output | Type | Description | |--------|------|-------------| | `GLOBAL_HISTORY` | `list[dict]` | Raw execution trace from `dspy.clients.base_lm` | | `metrics` | `dict` | Cost, latency, token counts from callbacks | ## Workflow ### Phase 1: Basic Inspection with inspect_history() The simplest debugging approach: ```python import dspy dspy.configure(lm=dspy.LM("openai/gpt-4o-mini")) # Run program qa = dspy.ChainOfThought("question -> answer") result = qa(question="What is the capital of France?") # Inspect last execution (prints to console) dspy.inspect_history(n=1) # To access raw history programmati...

Details

Author
OmidZamani
Repository
OmidZamani/dspy-skills
Created
5 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category