dspy

Construct RAG systems with declarative programming and automated prompt optimization.

2|Updated May 22, 2026
One-click install
npx skills add https://github.com/519lab/thoth-agent --skill dspy-519lab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/519lab/thoth-agent/tree/main/skills/mlops/research/dspy
Command: npx skills add https://github.com/519lab/thoth-agent --skill dspy-519lab

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill unit simplifies the creation of complex AI systems using declarative programming and automated prompt optimization, enhancing the reliability and efficiency of RAG systems.

Core Features & Use Cases

  • Declarative LM Programs: Build complex AI systems with multiple components and workflows using a simple declarative approach.
  • Prompt Optimization: Automate the optimization of prompts to improve model outputs systematically.
  • RAG Systems: Create and enhance RAG systems, agents, or classifiers with better reliability and performance.
  • Use Case: If you are building an AI chatbot and want to improve the quality of its responses, you can use this Skill to optimize the prompts and generate more coherent, relevant answers.

Quick Start

Run the skill and follow the provided prompts to build your RAG system using DSPy's declarative programming features.

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 RAG systems?

Automate prompt optimization for RAG systems by using declarative programming to define AI tasks, which compiles and optimizes prompts systematically to enhance language model performance. This replaces manual prompt engineering with programmatic tuning.

What is declarative LM programming and how does it build AI pipelines?

Declarative LM programming defines AI tasks through structural signatures rather than manual prompts, compiling end-to-end AI pipelines for agents and classifiers. It simplifies complex workflows by separating the program logic from the underlying language model calls.

Do I need OpenAI and Anthropic APIs to run DSPy programs?

Yes, you need OpenAI and Anthropic Claude APIs to compile and execute declarative language model calls. These dependencies provide the underlying compute for the automated prompt optimization and RAG system construction.

Can I build multi-component agents using declarative programming?

Yes, you can build complex AI systems with multiple components and workflows using a simple declarative approach. This allows you to construct end-to-end AI pipelines for agents and classifiers with better reliability and performance.

Why does manual prompt engineering fail for complex AI chatbots?

Manual prompt engineering lacks systematic tuning, reducing reliability for complex AI chatbots. Using declarative programming automates prompt optimization to generate more coherent, relevant answers by improving model outputs systematically.

What is the best way to improve response quality in RAG applications?

The best way to improve RAG response quality is using declarative programming to define tasks and automate prompt optimization. This systematically enhances model performance and builds reliable end-to-end AI pipelines for coherent answers.