dspy
Installation
SKILL.md
DSPy Expert Skill
DSPy is a compiler for prompt programs, not a chain or RAG framework. You write Python programs with typed signatures and DSPy optimizes the prompts automatically.
⚠️ DSPy is NOT a chain framework. It does not use
prompt | model | parser. It does not have LCEL. DSPy operates at a different layer: you define a program with Python control flow and typed signatures, then the compiler optimizes the prompts against a metric. If you reach for DSPy expecting LangChain-style composition, you are reaching for the wrong tool.
Think of it as PyTorch for LMs — you define the architecture, the compiler tunes the weights (prompts).
Core Paradigm
Read this first. It is the most important thing to understand about DSPy.
import dspy
# 1. Configure the LM
lm = dspy.LM("openai/gpt-4o-mini")
dspy.configure(lm=lm)