dspy-adapters-multimodal

Solid

This skill should be used when the user asks to "choose a DSPy adapter", "use JSONAdapter", "use XMLAdapter", "enable native function calling", "send images, audio, or files to DSPy", mentions `dspy.ChatAdapter`, `dspy.JSONAdapter`, `dspy.XMLAdapter`, `dspy.Image`, `dspy.Audio`, `dspy.File`, structured outputs, or multimodal DSPy signatures.

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 Adapters and Multimodal I/O ## Goal Choose an adapter deliberately and model image, audio, and file inputs with DSPy's typed primitives. ## Adapter Selection | Adapter | Use it for | |---------|------------| | `dspy.ChatAdapter()` | Default, human-readable field markers, broad model compatibility | | `dspy.JSONAdapter()` | Structured JSON output and native function calling where supported | | `dspy.XMLAdapter()` | XML-tagged fields when XML is easier for the target LM to follow | | `dspy.TwoStepAdapter()` | A separate extraction pass when parsing needs extra help | Configure globally or for a limited scope: ```python import dspy dspy.configure( lm=dspy.LM("openai/gpt-4o-mini"), adapter=dspy.JSONAdapter(), ) with dspy.context(adapter=dspy.XMLAdapter()): result = dspy.Predict("question -> answer")(question="What is DSPy?") ``` ## Native Function Calling `JSONAdapter` enables native function calling by default. `ChatAdapter` keeps text parsing by default. Override either behavior explicitly: ```python chat_native = dspy.ChatAdapter(use_native_function_calling=True) json_manual = dspy.JSONAdapter(use_native_function_calling=False) ``` DSPy falls back to manual parsing when the configured LM does not support native function calling. ## Image Inputs ```python class DescribeImage(dspy.Signature): image: dspy.Image = dspy.InputField() description: str = dspy.OutputField() describe = dspy.Predict(DescribeImage) result = describe(image=dspy.Ima...

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