What problem does it solve? Manual prompt engineering is fragile, hard to maintain, and difficult to improve systematically. DSPy replaces hand-tuned prompts with declarative signatures and modules that can be automatically optimized against your own data and metrics. ## Core Features & Use Cases - Declarative Signatures & Modules: Define tasks as input-output signatures and compose them with Predict, ChainOfThought, ReAct, and ProgramOfThought modules. - Automatic Optimization: Use teleprompters like BootstrapFewShot, MIPRO, and BootstrapFinetune to generate few-shot examples and improve instructions from training data. - Complex Pipelines: Build multi-stage RAG systems, agents with tools, classifiers, and structured extraction with Pydantic-typed outputs. - Use Case: Build a multi-hop RAG question-answering system, then optimize it with BootstrapFewShot on 50 labeled examples to measurably improve answer accuracy without rewriting prompts. ## Quick Start Install dspy with pip, configure your LM provider such as Claude or OpenAI, define a signature like "question -> answer", and run dspy.ChainOfThought on your first question.