dspy

Compile declarative language model calls into self-improving pipelines.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/zangjeicy/Hermes --skill dspy-zangjeicy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/zangjeicy/Hermes/tree/main/optional-skills/mlops/research/dspy
Command: npx skills add https://github.com/zangjeicy/Hermes --skill dspy-zangjeicy

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This skill addresses the fragility and manual labor of traditional prompt engineering by providing a framework to program language models declaratively, allowing for systematic, data-driven optimization of prompts and pipelines.

Core Features & Use Cases

  • Automatic Prompt Optimization: Uses data-driven methods to improve prompts and module performance without manual trial and error.
  • Modular AI Pipelines: Enables the creation of complex, maintainable AI systems like RAG, agents, and classifiers using reusable components.
  • Use Case: Build a multi-stage RAG system that automatically optimizes its retrieval and generation prompts based on a provided training dataset to maximize accuracy.

Quick Start

Use the dspy skill to configure a language model and define a signature for a question-answering module.

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 without manual trial and error?

Automatic prompt optimization uses data-driven methods to improve prompts and module performance without manual trial and error. It compiles declarative language model calls into self-improving pipelines by systematically optimizing prompts and few-shot examples.

What is declarative programming for AI pipelines?

Declarative programming for AI pipelines involves defining modular components like RAG, agents, and classifiers to create complex, maintainable AI systems. It shifts prompt engineering from fragile manual labor to systematic, data-driven optimization of language model behavior.

Can I build a multi-stage RAG system that automatically optimizes retrieval prompts?

Yes, you can build a multi-stage RAG system that automatically optimizes its retrieval and generation prompts. By using a provided training dataset, the framework maximizes accuracy through data-driven optimization of the underlying language model calls.

Does this approach work with both OpenAI and Anthropic models?

Yes, this approach supports building modular AI systems across various language model providers. It requires integration with the openai and anthropic libraries to execute and optimize LM programs effectively across different platforms.

How do I configure a language model and define a signature for question answering?

To configure a language model and define a signature for question answering, you use the framework to establish a declarative module. This module compiles your specified inputs and outputs into optimized few-shot examples for the LM pipeline.

What are the limitations of automatic prompt optimization for AI agents?

The limitations of automatic prompt optimization include the requirement to integrate specific libraries like dspy, openai, and anthropic to execute programs. Additionally, users must provide a training dataset to successfully drive the data-driven optimization of prompts.