dspy

Compile high-level Python specifications into optimized LLM calls.

11.5k|842|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill dspy-orchestra-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/16-prompt-engineering/dspy
Command: npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill dspy-orchestra-research

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill tackles the complexity and brittleness of traditional prompt engineering by enabling declarative programming for Large Language Models, automating prompt optimization, and building modular, maintainable AI systems.

Core Features & Use Cases

  • Declarative LM Programming: Define AI tasks using signatures and modules, abstracting away prompt details.
  • Automatic Prompt Optimization: Improve LM performance systematically using data-driven optimizers.
  • Modular AI Systems: Build complex pipelines, agents, and RAG systems with reusable components.
  • Use Case: Develop a customer support chatbot that can understand user intent, retrieve relevant information from a knowledge base, and generate helpful responses, all while automatically optimizing its prompts for better accuracy and consistency.

Quick Start

Use the dspy skill to build a question-answering system by defining a signature and using a Predict module.

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 LLM applications?

Automate prompt optimization by defining high-level task specifications and signatures, allowing data-driven optimizers to systematically compile and improve LM calls without manual prompt engineering.

What is declarative AI programming and how does it help build modular AI systems?

Declarative AI programming abstracts prompt details by defining tasks through signatures and modules, enabling developers to build complex, modular pipelines and self-improving agents with reusable components.

Can I build RAG systems and AI agents using declarative LLM programming?

Yes, you can build RAG systems and AI agents by utilizing modular components that facilitate information retrieval, reasoning, and tool use while automatically compiling high-level specifications into optimized calls.

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

Yes, declarative LM programming supports various LM providers including OpenAI and Anthropic, allowing you to seamlessly integrate and optimize structured output, reasoning, and tool use across different models.

What is the best way to structure complex AI pipelines without writing brittle prompts?

The best way to avoid brittle prompts is using a declarative Python framework that replaces manual prompt engineering with modular signatures and data-driven automatic optimization for maintainable AI systems.

Why does my LLM output fluctuate and how can declarative programming stabilize it?

LLM output fluctuates due to brittle manual prompts; declarative programming stabilizes this by compiling high-level specifications into optimized, data-driven LM calls to ensure consistency and accuracy.