Cover of Building LLM Applications with DSPy by Serj Smorodinsky and Brett Kennedy

Serj Smorodinsky · Brett Kennedy · Manning

Published by Manning

Building LLM Applications with DSPy

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 applications that can be evaluated and improved

Build reliable classification, summarization, RAG, and agentic systems with DSPy—using task definition, evaluation, and optimization as first-class engineering practices.

01

Define the task

Turn prompt-shaped behavior into modular programs with explicit inputs, outputs, and constraints.

02

Measure what matters

Build datasets and evaluation loops that reveal whether the system is actually getting better.

03

Optimize systematically

Use DSPy to improve prompts and pipelines as models, requirements, and data change.

Open companion repository

Read the book. Run the code. Extend the ideas.

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