dspy

Compose DSPy modules and automate prompt optimization in Python.

Updated Apr 27, 2026
One-click install
npx skills add https://github.com/AissenLiu/EasyHermes --skill dspy-aissenliu
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/AissenLiu/EasyHermes/tree/main/hermes-agent/skills/mlops/research/dspy
Command: npx skills add https://github.com/AissenLiu/EasyHermes --skill dspy-aissenliu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Declarative DSPy enables building complex AI systems by composing modular components and automating prompt improvements.

Core Features & Use Cases

  • Declarative language model programming with modular components (Predict, ChainOfThought, ReAct, ProgramOfThought)
  • Support for RAG systems, multi-stage pipelines, tool-enabled agents, and structured outputs
  • Data-driven prompt optimization via built-in teleprompters (BootstrapFewShot, MIPRO, BootstrapFinetune, COPRO, KNNFewShot)

Quick Start

Provide a DSPy module that answers a complex question with step-by-step reasoning and demonstrate bootstrapping few-shot optimization.

Frequently Asked Questions about dspy

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

FAQPage Schema
How do I automate prompt optimization for RAG systems?▼

Automate RAG prompt optimization by defining declarative modules and applying DSPy teleprompters like BootstrapFewShot or MIPRO. These optimizers compile data-driven demonstrations into your pipeline, automatically improving prompt quality without manual tuning.

How do I build multi-stage AI pipelines with tool-enabled agents?▼

Build multi-stage AI pipelines with tool-enabled agents by declaratively composing DSPy modules such as ReAct and ProgramOfThought. This modular approach chains reasoning steps and tool interactions into structured outputs without hard-coded prompts.

Do I need Python to use DSPy for declarative AI pipelines?▼

Yes, you need Python and the DSPy package installed to build declarative AI pipelines. The framework provides modular components and optimizers that require a Python environment to compose and execute complex AI workflows.

What is the best way to structure step-by-step reasoning in AI pipelines?▼

Structure step-by-step reasoning using the DSPy ChainOfThought module within declarative AI pipelines. This approach programmatically defines reasoning stages and supports automated prompt improvement through built-in optimizers like KNNFewShot.

What is the difference between BootstrapFewShot and MIPRO optimizers?▼

BootstrapFewShot generates few-shot examples by simulating successful pipeline executions, while MIPRO optimizes prompts by proposing instructions and demonstrations across multiple stages. Both are DSPy teleprompters used for data-driven prompt improvement.

Can I use DSPy optimizers without structured training data?▼

DSPy optimizers like BootstrapFewShot require some input examples to bootstrap few-shot demonstrations. Without structured training data, optimizers cannot effectively evaluate and improve the declarative pipeline's prompt quality or reasoning steps.