DSPy Declarative LLM Programming
Build LLM pipelines as composable modules with DSPy. Writes signatures, chain-of-thought modules, retrieval-augmented programs, and bootstrapped few-shot optimizers that improve prompts automatically from data.
Stop hand-tuning prompts. DSPy lets you declare what an LLM call should do via typed signatures and compile prompts from labeled examples. This skill builds modules, sets up optimizers like BootstrapFewShot and MIPROv2, and runs evaluations against your metric.
When to use
Use when prompts are brittle or hard to improve by hand, when you have eval data and want to compile better prompts automatically, or when chaining several LLM steps that all need to be tuned together.
Examples
Compile a classification module
Turn a labeled dataset into an optimized DSPy program
Use DSPy BootstrapFewShot to compile a support-ticket classifier from our 500 labeled examples and measure accuracy on a held-out set
Multi-hop RAG pipeline
Chain retrieve, reason, and answer modules
Build a DSPy multi-hop RAG program with a Retrieve module, a ChainOfThought reasoner, and an Answer module optimized end-to-end