We walk through DSPy with a practical lens: signatures and modules, RAG, multi-step pipelines, a ReAct-style tool-using agent, and running an optimizer so the framework can improve its own prompts. Along the way we cover when DSPy is worth it vs plain prompting, and production-minded patterns—saving optimized programs, assertions, streaming, and caching.
Code for this video
https://github.com/ekb-dev-ai/dspy-demo
Clone the repo and run the scripts with Poetry (poetry install, then poetry run python …). See the README for which file maps to which topic.
00:00 Intro
06:37 Program 1: Sentiment Classifier (Traditional vs DSPy)
13:28 Program 2: RAG Pipeline
19:34 Program 3: Multi-Step Reasoning Chain
29:03 Program 4: Self-Correcting Agent with ReAct
34:20 Program 5: The Optimizer — DSPy's Real Superpower
41:24 Summary
#DSPy #Python #LLM #AI #MachineLearning #PromptEngineering #RAG #LangChain #OpenSource #Ollama #AIAgents #FineTuning #Coding #Programming