dspy

Automate declarative LM programming with auto-prompt optimization and RAG workflows.

Updated May 21, 2026
One-click install
npx skills add https://github.com/samlaggz/hermes-agent-sam --skill dspy-samlaggz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/samlaggz/hermes-agent-sam/tree/main/backup/skills/mlops/research/dspy
Command: npx skills add https://github.com/samlaggz/hermes-agent-sam --skill dspy-samlaggz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

DSPy provides a declarative framework to build scalable LM pipelines and automatically optimize prompts, reducing manual trial-and-error in complex AI systems.

Core Features & Use Cases

  • Declarative modules (Predict, ChainOfThought, ReAct, ProgramOfThought) for structured LM tasks and safer composition.
  • Teleprompter optimizers (BootstrapFewShot, MIPRO, BootstrapFinetune, COPRO, KNNFewShot) to improve prompts from data.
  • RAG, agents, and multi-stage pipelines combining retrieval, reasoning, and generation with strong typing and guardrails.

Quick Start

Provide an end-to-end DSPy workflow to optimize prompts and pipelines from your training data.

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 large language model pipelines?

You can automate prompt optimization by applying teleprompter optimizers like BootstrapFewShot or MIPRO to your training data. This declarative programming approach automatically generates and refines prompts, eliminating manual trial-and-error when building scalable AI pipelines.

What is the best way to build modular multi-step reasoning tasks with language models?

Building multi-step reasoning tasks is best achieved using declarative modules like ChainOfThought, ReAct, and ProgramOfThought. These modules enable safer composition and strong typing, allowing you to structure complex reasoning and generation workflows with built-in guardrails.

How do I structure retrieval-augmented generation and agents without manual prompt engineering?

You can structure retrieval-augmented generation and agents by defining declarative LM pipelines that combine retrieval, reasoning, and generation. The framework automatically handles prompt optimization from your training data, removing the need for manual prompt engineering in multi-stage workflows.

Can I use declarative programming to optimize prompts for RAG workflows?

Yes, you can use declarative programming to optimize prompts for RAG workflows. The framework supports combining retrieval, reasoning, and generation stages, while teleprompter optimizers automatically refine the underlying prompts using your provided training data.

Do I need training data to use automatic prompt optimizers like BootstrapFewShot?

Yes, you need training data to use automatic prompt optimizers like BootstrapFewShot, MIPRO, and COPRO. These optimizers analyze your provided examples to automatically improve and refine prompts, reducing manual effort in complex AI systems.

When should I avoid using declarative LM pipelines for AI agent development?

You should avoid using declarative LM pipelines if your project lacks sufficient training data for the teleprompter optimizers or if your tasks do not require structured composition, multi-step reasoning, or automated prompt refinement.