What problem does it solve?
DSPy eliminates fragile, manual prompt engineering by letting you build language model systems with declarative components and then optimize them using data and objective metrics.
Core Features & Use Cases
- Declarative LM programming: Define signatures (inputs → outputs) and compose modules for tasks like QA, extraction, and generation.
- Automatic prompt optimization: Compile modules with optimizers that search for better instructions/few-shot examples using a metric over examples.
- Modular pipelines for RAG and agents: Create maintainable systems with retrieval, multi-stage reasoning, and tool-using agent patterns.
- Use case: Build a RAG question-answering system that retrieves relevant passages, generates answers from retrieved context, and then improves reliability by optimizing against a held-out evaluation metric.
Quick Start
Ask the AI assistant to build a simple DSPy RAG pipeline, then compile it using a small training set and a correctness metric you define.