dspy

Compile declarative DSPy programs into optimizable pipelines from labeled examples.

1|Updated May 16, 2026
One-click install
npx skills add https://github.com/devMoez/titan --skill dspy-devmoez
Or copy as Structured Prompt for Agentâ–¼
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/devMoez/titan/tree/main/skills/mlops/research/dspy
Command: npx skills add https://github.com/devMoez/titan --skill dspy-devmoez

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

DSPy removes brittle, manual prompt engineering by letting you define LM programs declaratively and automatically optimize them using feedback from data.

Core Features & Use Cases

  • Declarative signatures and composable modules: Define inputs/outputs and build pipelines like QA, RAG, and multi-stage reasoning.
  • Automatic prompt optimization with teleprompters: Improve performance by compiling modules against labeled examples and evaluation metrics.
  • Reliable RAG and agent workflows: Combine retrieval, reasoning, tool-using patterns, reranking, and typed structured outputs.

Use Case: You want a higher-accuracy RAG QA system that retrieves relevant passages, generates grounded answers, and improves its prompting using a small set of question/answer examples.

Quick Start

Use DSPy to build a RAG question-answering pipeline that defines a signature, configures a retriever, and then compiles the module using BootstrapFewShot with your custom exact-match metric.

Frequently Asked Questions about dspy

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

FAQPage Schema
How do I auto-optimize LLM pipelines instead of manual prompt engineering?â–¼

You can auto-optimize LLM pipelines by defining declarative signatures and modules, then using teleprompters to compile them against labeled examples and evaluation metrics. This replaces manual prompt engineering with automated instruction and few-shot demo improvement.

How do I build a reliable RAG QA system with structured outputs?â–¼

Build a reliable RAG QA system by defining a DSPy signature for question answering, configuring a retriever for relevant passages, and compiling the module using an optimizer like BootstrapFewShot with a custom exact-match metric to improve grounded answer generation.

What is teleprompting for language model pipelines?â–¼

Teleprompting is the process of automatically optimizing LM pipeline instructions and few-shot demonstrations using an optimizer and evaluation metric. It compiles declarative modules against labeled examples to improve performance for tasks like classification, extraction, and multi-stage reasoning.

Do I need labeled examples to compile and optimize LM pipelines?â–¼

Yes, you need labeled examples and an evaluation metric to compile LM pipelines. The optimizer uses these examples to automatically improve instructions and few-shot demos, ensuring portable and maintainable prompts for RAG, classification, and agent workflows.

Does DSPy work with OpenAI and Anthropic models?â–¼

Yes, DSPy works with OpenAI and Anthropic models. These dependencies allow you to declaratively build and auto-optimize language model pipelines across different providers for classification, extraction, and multi-stage reasoning tasks.

What's the best way to maintain prompt portability across multi-stage reasoning tasks?â–¼

The best way to maintain prompt portability is to define declarative signatures and composable modules for your multi-stage reasoning tasks. Compiling these modules with an optimizer ensures prompts are automatically improved and remain maintainable across different model calls.