dspy-chatadapter
Installation
SKILL.md
dspy.ChatAdapter -- How DSPy Formats Prompts
Step 1: Understand what you need
Before diving into adapter internals, clarify:
- Are you debugging a formatting issue? (model ignores format, parse errors, wrong output structure)
- Do you need to customize how prompts are built? (system messages, field order, special providers)
- Are you generating fine-tuning data? (need OpenAI-compatible message format)
- Do you need native function calling or structured output? (provider-specific features)
If you just need to pick the right adapter, start with /dspy-adapters instead -- it covers the decision between ChatAdapter, JSONAdapter, TwoStepAdapter, and XMLAdapter.
What ChatAdapter does
ChatAdapter is the default adapter in DSPy. Every time a module calls an LM, ChatAdapter handles two jobs:
- Format: Converts signature + demos + inputs into a list of chat messages (system, user, assistant)
- Parse: Extracts output fields from the LM response using
[[ ## field_name ## ]]delimiters