dspy

Compile declarative language model programs into self-improving pipelines with automated prompt optimization.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill solves the fragility and manual labor of traditional prompt engineering by providing a framework to program language models declaratively and optimize them automatically.

Core Features & Use Cases

  • Declarative Programming: Define AI tasks using signatures (input to output) rather than writing brittle prompt templates.
  • Automatic Optimization: Use data-driven optimizers to systematically improve prompt instructions and few-shot examples.
  • Modular Pipelines: Build complex, maintainable AI systems like RAG, agents, and multi-stage classifiers that are portable across different language models.

Quick Start

Use the dspy skill to configure a language model and compile a question-answering module using a provided training dataset.

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 language models instead of manual tuning?

Automate prompt optimization by defining AI tasks declaratively and using data-driven optimizers to systematically improve instructions and few-shot examples. This compiles modular pipelines like RAG and agents into self-improving workflows.

What's the best way to build maintainable RAG pipelines that are portable across different language models?

Build maintainable RAG pipelines by defining modular tasks using declarative signatures rather than brittle prompt templates. This approach compiles complex workflows into systems that are portable across different language models.

Do I need OpenAI or Anthropic to compile declarative LM programs?

Yes, you need OpenAI or Anthropic to compile declarative LM programs. Integrating with a language model provider is required to execute the modular AI tasks and run the automated optimization process.

How does declarative programming compare to writing manual prompt templates for AI agents?

Declarative programming replaces manual prompt templates by defining input-to-output signatures. This avoids prompt fragility and uses automated optimizers to systematically improve agentic reasoning and classification workflows.

Can I use few-shot learning to improve multi-stage classification workflows?

Yes, you can use few-shot learning to improve multi-stage classification workflows. Data-driven optimizers systematically generate and refine few-shot examples to enhance the accuracy of complex AI system pipelines.