dspy

Compile declarative language model calls into self-improving pipelines.

Updated Jun 25, 2026
One-click install
npx skills add https://github.com/Rheasilvia/hermes-desktop --skill dspy-rheasilvia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/Rheasilvia/hermes-desktop/tree/main/optional-skills/mlops/research/dspy
Command: npx skills add https://github.com/Rheasilvia/hermes-desktop --skill dspy-rheasilvia

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 (inputs and outputs) 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 optimize a question-answering module by compiling it against a provided training dataset of question-answer pairs.

Frequently Asked Questions about dspy

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

FAQPage Schema
How do I automate prompt engineering for LLM agents instead of writing manual templates?

Automate prompt engineering by compiling declarative language model programs into self-improving pipelines. This framework abstracts prompts into modular signatures and uses data-driven optimizers to systematically improve instructions.

What is the best way to build portable RAG systems across different language models?

Build portable RAG systems by defining modular pipelines declaratively rather than using brittle prompt templates. This approach allows complex retrieval workflows to be compiled and optimized independently of the underlying language model.

How do I optimize few-shot examples for multi-stage classification tasks?

Optimize few-shot examples by compiling declarative modules against a training dataset of input-output pairs. The framework uses automatic optimizers to synthesize effective demonstrations and improve multi-stage classification accuracy.

Do I need training data to use automatic prompt optimization?

Training data is required to execute automatic prompt optimization. You must provide a dataset of input-output examples so the compiler can systematically improve prompt instructions and synthesize few-shot demonstrations.

Does this declarative programming approach work with OpenAI and Anthropic models?

This declarative programming approach works with OpenAI and Anthropic models. It requires integration with language model providers to execute the automatic prompt optimization and compile the modular pipelines.

Why does my manually engineered prompt break when I switch language models?

Manually engineered prompts break due to their inherent fragility across different language models. Declarative programming solves this by abstracting tasks into signatures, allowing modular pipelines to remain portable and automatically optimized.