
A comprehensive, hands-on learning environment for mastering DSPy (Declarative Self-improving Language Programs). Build practical skills in programming with language models through progressive labs and real-world applications.
11 progressive labs with 80+ exercises covering DSPy fundamentals, advanced patterns, and production deployment. Completely free and open source. Built for practical AI engineering.
This educational resource bridges the gap between understanding LLMs and building production-ready AI systems:
- Learn by Doing: Progressive hands-on labs build real DSPy skills
- Declarative Paradigm: Master the DSPy approach to LLM programming
- Self-Improving Systems: Build programs that optimize themselves
- Production Patterns: Learn deployment, monitoring, and scaling
- Real-World Focus: Practical applications and use cases
- Community Driven: Built and improved by the AI engineering community
Our curriculum builds skills progressively through four phases:
- Foundation (Labs 0-2): Setup, fundamentals, and first programs
- Core Concepts (Labs 3-5): Signatures, modules, evaluation, and optimization
- Advanced Patterns (Labs 6-8): Complex reasoning, pipelines, and RAG
- Production Applications (Labs 9-11): Agents, real-world apps, and deployment
Each lab includes:
- Clear Learning Objectives: Know what you'll achieve
- Step-by-Step Instructions: Guided practical exercises
- Real-World Scenarios: Practical AI engineering use cases
- Solution Notebooks: Reference implementations
- Production Patterns: Best practices for deployment
Phase 1: Foundation (Labs 0-2)
Focus: Setup and first steps with DSPy
- Lab 0: Environment Setup - Install DSPy and validate your environment
- Lab 1: DSPy Fundamentals - Understand the declarative programming paradigm
- Lab 2: Your First DSPy Program - Build your first self-improving program
Phase 2: Core Concepts (Labs 3-5)
Focus: Essential DSPy building blocks
- Lab 3: Signatures and Modules - Master DSPy's core abstractions
- Lab 4: Data and Evaluation - Measure and improve program performance
- Lab 5: Optimization Strategies - Make your programs self-improving
Phase 3: Advanced Patterns (Labs 6-8)
Focus: Complex AI systems and pipelines
- Lab 6: Chain of Thought - Implement complex reasoning patterns
- Lab 7: Multi-Stage Programs - Build sophisticated AI pipelines
- Lab 8: Retrieval Augmented Generation - RAG systems with DSPy
Phase 4: Production Applications (Labs 9-11)
Focus: Real-world applications and deployment
- Lab 9: Building AI Agents - Create autonomous AI systems
- Lab 10: Real-World Applications - Practical use cases and patterns
- Lab 11: Production Deployment - Deploy, monitor, and scale DSPy systems
- Python 3.8+
- Basic understanding of Python
- Familiarity with LLM concepts (helpful but not required)
- API key for an LLM provider (OpenAI, Anthropic, etc.)
# Clone the repository
git clone https://github.com/nellaivijay/dspy-code-practice.git
cd dspy-code-practice
# Install dependencies
pip install -r requirements.txt
# Set up your LLM API key
export OPENAI_API_KEY="your-api-key"
# or for other providers
export ANTHROPIC_API_KEY="your-api-key"
- Begin with Lab 0: Environment Setup to configure your environment
- Progress through labs sequentially for optimal learning
- Use the provided notebooks for interactive learning
- Reference solution notebooks when needed
- Build your own projects using learned patterns
- DSPy: Declarative self-improving language programs
- Python: Primary programming language
- LLM Providers: OpenAI, Anthropic, local models
- Jupyter: Interactive notebooks for learning
- pytest: Testing framework
- pandas: Data manipulation
- numpy: Numerical operations
- matplotlib: Visualization
dspy-code-practice/
├── labs/ # Lab guides and exercises
├── notebooks/ # Student Jupyter notebooks
├── solutions/ # Solution notebooks
├── scripts/ # Utility scripts
├── data/ # Sample datasets
├── docs/ # Additional documentation
├── .github/ # GitHub workflows and wiki
├── requirements.txt # Python dependencies
└── README.md # This file
Duration: 2-3 hours
Outcome: Build your first DSPy program and understand the paradigm
- Complete Lab 0: Environment Setup
- Complete Lab 1: DSPy Fundamentals
- Complete Lab 2: Your First DSPy Program
Intermediate Path (Labs 3-5)
Duration: 4-5 hours
Outcome: Master core DSPy concepts and optimization
- Complete Lab 3: Signatures and Modules
- Complete Lab 4: Data and Evaluation
- Complete Lab 5: Optimization Strategies
Duration: 5-6 hours
Outcome: Build complex AI systems and pipelines
- Complete Lab 6: Chain of Thought
- Complete Lab 7: Multi-Stage Programs
- Complete Lab 8: Retrieval Augmented Generation
Production Path (Labs 9-11)
Duration: 6-8 hours
Outcome: Deploy production-ready DSPy applications
- Complete Lab 9: Building AI Agents
- Complete Lab 10: Real-World Applications
- Complete Lab 11: Production Deployment
After completing the labs, apply your skills to build:
- Question Answering System: Build a simple QA bot
- Text Summarizer: Create summarization pipelines
- Sentiment Analyzer: Analyze text sentiment with DSPy
- Document Classifier: Classify documents using DSPy
- Code Generator: Generate code from natural language
- Data Extraction System: Extract structured data from text
- Research Assistant: Build an AI research assistant
- Customer Support Bot: Create intelligent support systems
- Content Generation Pipeline: Automated content creation
Comprehensive wiki documentation is available with detailed guides:
This is a practice environment for learning. Contributions are welcome:
- New Labs: Suggest new lab topics and exercises
- Better Explanations: Improve clarity of existing content
- Additional Examples: Add more practical examples
- Bug Fixes: Report and fix issues in labs or documentation
🔗 Related Practice Repositories
Continue your learning journey with these related repositories:
Data Engineering Practice
This repository uses only open-source tools and focuses on educational value:
- DSPy (MIT License)
- Python packages (various open source licenses)
- No proprietary cloud services required for basic learning
- Vendor-independent LLM provider support
Apache License 2.0 - Free for educational and commercial use
Join our learning community:
- ⭐ Star the repository to show support
- 🐛 Report issues and suggest improvements
- 🔄 Submit pull requests with enhancements
- 💬 Share your projects and learnings
- Set up your environment following Lab 0
- Start with Lab 1 to understand DSPy fundamentals
- Progress through labs at your own pace
- Build your own projects using learned patterns
- Share your work with the community
Ready to master DSPy? Start with Lab 0 and begin your journey into declarative LLM programming!