Community Examples
The DSPy team believes complexity has to be justified. We take this seriously: we never release a complex tutorial (above) or example (below) unless we can demonstrate empirically that this complexity has generally led to improved quality or cost. This kind of rule is rarely enforced by other frameworks or docs, but you can count on it in DSPy examples.
There's a bunch of examples in the examples/
directory and in the top-level directory. We welcome contributions!
You can find other examples tweeted by @lateinteraction on Twitter/X.
Some other examples (not exhaustive, feel free to add more via PR):
- Applying DSPy Assertions
- Compiling LCEL runnables from LangChain in DSPy
- AI feedback, or writing LM-based metrics in DSPy
- DSPy Optimizers Benchmark on a bunch of different tasks, by Michael Ryan
- Indian Languages NLI with gains due to compiling by Saiful Haq
- Sophisticated Extreme Multi-Class Classification, IReRa, by Karel D’Oosterlinck
- DSPy on BIG-Bench Hard Example, by Chris Levy
- Using Ollama with DSPy for Mistral (quantized) by @jrknox1977
- Using DSPy, "The Unreasonable Effectiveness of Eccentric Automatic Prompts" (paper) by VMware's Rick Battle & Teja Gollapudi, and interview at TheRegister
- Portkey with DSPy: Efficiently Track Metrics, Optimize Performance, and Scale Across 250+ LLMs
- Langtrace AI DSPy Examples Repository
- Langtrace Blogpost - Build a summarization system using DSPy
There are also recent cool examples at Weaviate's DSPy cookbook by Connor Shorten. See tutorial on YouTube.