dspy

Compose declarative LM pipelines with optimizers like BootstrapFewShot and MIPRO.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/KarlinskyS/hermesSkills --skill dspy-karlinskys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/KarlinskyS/hermesSkills/tree/main/mlops/research/dspy
Command: npx skills add https://github.com/KarlinskyS/hermesSkills --skill dspy-karlinskys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

DSPy removes the ad-hoc, brittle process of manual prompt engineering by providing a declarative framework to compose, optimize, and maintain language-model-based systems across development and production.

Core Features & Use Cases

  • Declarative Module Composition: Define Signatures and Modules to turn inputs into typed outputs and compose multi-stage pipelines for RAG, agents, classification, and summarization.
  • Automatic Prompt & Module Optimization: Improve prompts and few-shot demonstrations programmatically using optimizers like BootstrapFewShot, MIPRO, and BootstrapFinetune.
  • Multi-provider & Retrieval Integration: Swap LM providers (OpenAI, Anthropic, local runtimes), configure retrievers, and export optimized modules for production use.
  • Use Case: Build a RAG-based QA system that retrieves top passages, applies ChainOfThought reasoning, and is automatically optimized with representative training examples.

Quick Start

Create a ChainOfThought QA module that retrieves three passages, answers concisely, and optimize it using BootstrapFewShot.

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 prompts programmatically?▼

You can optimize language model prompts programmatically by applying optimizers like BootstrapFewShot, MIPRO, and BootstrapFinetune to declarative modules, automatically improving prompts and few-shot demonstrations using representative training examples.

What is the best way to build a modular RAG pipeline with ChainOfThought reasoning?▼

The best way to build a modular RAG pipeline is by composing declarative modules that retrieve top passages and apply ChainOfThought reasoning, allowing you to structure multi-stage workflows for question answering and classification.

Can I swap LM providers when building multi-stage AI pipelines?▼

Yes, you can swap LM providers like OpenAI, Anthropic, and local runtimes in your multi-stage AI pipelines, allowing you to configure and export optimized modules for production use without altering the underlying pipeline logic.

Why does manual prompt engineering become brittle for production agents?▼

Manual prompt engineering becomes brittle because it relies on ad-hoc adjustments that fail to scale, whereas using a declarative framework allows you to compose, automatically optimize, and maintain language-model systems across development and production.

Does DSPy work with local runtimes for classification and summarization tasks?▼

DSPy works with local runtimes for classification and summarization tasks by defining typed inputs and outputs through Signatures and Modules, enabling multi-provider configuration and automatic optimization of the underlying language model calls.