dspy

Automate declarative development and optimization of language model workflows.

4|Updated May 18, 2026
One-click install
npx skills add https://github.com/ZardLi1115/zedclaw --skill dspy-zardli1115
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/ZardLi1115/zedclaw/tree/main/skills/mlops/research/dspy
Command: npx skills add https://github.com/ZardLi1115/zedclaw --skill dspy-zardli1115

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dspy, openai, anthropic, and includes references (resource) components.

What problem does it solve?

DSPy helps you avoid brittle, manually-crafted prompt pipelines by letting you describe model behavior declaratively and then automatically optimize it using data and evaluation metrics.

Core Features & Use Cases

  • Declarative Signatures: Define inputs and outputs for tasks like question answering, summarization, and information extraction.
  • Modular Reasoning Pipelines: Compose predictors and reasoning modules such as Predict, ChainOfThought, ReAct (tool-using), and ProgramOfThought (code-based).
  • Automatic Prompt Optimization for RAG and Agents: Use optimizers to compile better prompting strategies from examples, including RAG workflows and reranking approaches.

Example use case: You have a dataset of user questions with expected answers and you want a RAG agent that retrieves relevant passages, generates answers, and improves accuracy via an optimizer-driven evaluation loop.

Quick Start

Configure DSPy with your chosen LLM and create a signature-based QA predictor, then run it on a question to get an answer.

Frequently Asked Questions about dspy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize language model workflows automatically instead of manually writing prompts?

Declarative LM programming lets you define task inputs and outputs as signatures, then use optimizers and evaluation metrics to automatically compile better prompting strategies from your examples.

Can I build retrieval-augmented generation pipelines with multi-hop retrieval and reranking?

Yes, RAG pipelines support multi-hop retrieval and reranking approaches. You define the retrieval modules declaratively, then compile the workflow using optimizers to improve generation accuracy.

How do I set up structured extraction and question answering pipelines for OpenAI or Anthropic models?

Configure your chosen LM backend like OpenAI or Anthropic, define declarative signatures for structured extraction or QA, then execute the pipeline to generate reliable outputs without manual prompt engineering.

What is the best way to avoid brittle prompt pipelines when building tool-using agents?

Declarative LM programming replaces brittle manual prompts by defining agent behavior modularly using reasoning modules like ReAct, then automatically optimizing the behavior with data and evaluation metrics.

Does this approach require coding knowledge to compile reasoning pipelines with teleprompters?

Yes, building and compiling pipelines requires defining DSPy Signatures and Modules in code, then optionally compiling them with teleprompters using custom evaluation metrics to optimize performance.

Why does my prompt optimization pipeline produce inconsistent results across different language model providers?

Inconsistent results often stem from unoptimized manual prompts. Using teleprompters to compile your declarative pipeline with evaluation metrics standardizes behavior across LM backends like OpenAI and Anthropic.