dspy

Create modular AI pipelines with declarative programming and language models.

1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/aivos-xie/hermes-skills --skill dspy-aivos-xie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/aivos-xie/hermes-skills/tree/main/mlops/research/dspy
Command: npx skills add https://github.com/aivos-xie/hermes-skills --skill dspy-aivos-xie

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill allows you to build complex AI systems using declarative programming with Language Models (LMs), focusing on optimizing prompts and building modular pipelines.

Core Features & Use Cases

  • Declarative LM Programs: Create modular AI pipelines that use LMs for reasoning and decision-making.
  • Prompt Optimization: Automatically optimize prompts for better model outputs.
  • Use Case: Build a multi-step RAG system for answering complex questions by integrating retrieval, reasoning, and generation.

Quick Start

Use the dspy skill to create a simple QA system with the following command: dspy create qa --prompt "Question: {input} | Answer: {output}".

Frequently Asked Questions about dspy

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

FAQPage Schema
How do I optimize prompts automatically for large language models?

Automatic prompt optimization for large language models is handled by using DSPy to programmatically adjust and refine prompts, shifting from manual tuning to declarative optimization for improved model performance.

What is the best way to build a multi-step RAG system?

Building a multi-step RAG system is achieved by creating modular AI pipelines with DSPy, which integrates retrieval, reasoning, and generation steps into a single declarative program.

Do I need specific API providers to use declarative LM programs?

Specific API providers are required to use declarative LM programs, as the system depends on the dspy, openai, and anthropic libraries to interface with your chosen language model provider.

Can I use declarative programming to build AI agents and classifiers?

Declarative programming can be used to build AI agents and classifiers, allowing you to define modular pipelines where language models handle the reasoning and decision-making tasks.

How do I create a simple QA pipeline with DSPy?

Creating a simple QA pipeline with DSPy involves running a create command with a specified prompt template, immediately setting up a modular reasoning system for answering questions.