01
Define the task
Turn prompt-shaped behavior into modular programs with explicit inputs, outputs, and constraints.
by Serj Smorodinsky
Serj Smorodinsky · Brett Kennedy · Manning
Published by Manning
Replacing manual prompts with systematic optimization
A practical guide by Serj Smorodinsky and Brett Kennedy for anyone building applications with LLMs. Learn to define tasks as modular Python programs, evaluate prompt effectiveness, and automatically optimize prompts as models and data change.
A methodology, not a bag of prompts
Build reliable classification, summarization, RAG, and agentic systems with DSPy—using task definition, evaluation, and optimization as first-class engineering practices.
01
Turn prompt-shaped behavior into modular programs with explicit inputs, outputs, and constraints.
02
Build datasets and evaluation loops that reveal whether the system is actually getting better.
03
Use DSPy to improve prompts and pipelines as models, requirements, and data change.
Open companion repository
The public repository contains the source code and working examples that accompany the book. Use it to follow along, inspect the implementations, and adapt the patterns for your own DSPy applications.
Explore the open repository