
The Real Python Podcast Programmatically Developing LLM Prompts With DSPy
52 snips
Aug 7, 2026 Brett Kennedy, author and applied ML practitioner who builds real-world LLM systems, explains DSPy and programmatic prompting. He describes declarative signatures, optimizers that search and tune prompts, and moving from brittle manual prompts to higher-level prompt programming. He also covers RAG workflows, evaluation with judge models, and practical patterns for production LLM apps.
AI Snips
Chapters
Books
Transcript
Episode notes
DSPy Automates Prompt Engineering From Signatures
- DSPy automates prompt engineering by generating and optimizing prompts from a high-level task signature.
- You declare inputs/outputs and test examples; DSPy then writes prompts, tunes them, and evaluates responses for you.
Signatures Let You Specify Precise Output Types
- Signatures in DSPy let you declare precise input and output types, including formats like JSON fields and date formats.
- Explicit typing guides LLM behavior and makes prompts clearer and more reliable across use cases.
Manual Prompt Tricks Break Across Models
- Manual prompt engineering is brittle because many small tricks (personas, chain-of-thought, rewording) work inconsistently across models.
- DSPy treats prompt tuning like model training: the framework experiments rather than relying on human guesswork.




