Program, don’t prompt,
your LLMs.
DSPy is a Python framework for building AI systems. Express your tasks as structured signatures, not prompts, to produce maintainable, modular, and optimizable programs.
Compose programs with reusable primitives.
Signatures
Define your task as typed inputs and outputs instead of managing messy prompts. Portable, maintainable, and easy to iterate on.
Modules
Modules control how your signature executes. Reason, run ensembles, use tools, add a REPL, and more without rewriting your task.
Optimizers
Give DSPy examples and a scoring function. It tunes your prompts automatically until quality converges.
Define a task. Grow it into a system.
Built in the open, since Dec 2022.
DSPy started at Stanford NLP and grew into a research community. New optimizers and module types land here first — then show up in production systems at companies you’ve heard of.