dspy-adapters
Installation
SKILL.md
Control Prompt Formatting with DSPy Adapters
Adapters sit between your DSPy modules and the language model. They control how signatures get turned into prompts and how LM responses get parsed back into typed Python objects. Most of the time the default adapter just works -- but when you need tighter control over structured output, or you are working with reasoning models that struggle with formatting, adapters give you that control.
What adapters do
Every time a DSPy module calls an LM, an adapter handles two jobs:
- Format -- Convert the signature, few-shot demos, and inputs into a prompt (system message + user/assistant messages).
- Parse -- Extract the output fields from the LM's raw text response and cast them to the declared Python types.
You never call adapters directly. You configure one globally or per-module, and DSPy uses it behind the scenes.