What problem does it solve?
DSPy helps you avoid brittle, manually-crafted prompt pipelines by letting you describe model behavior declaratively and then automatically optimize it using data and evaluation metrics.
Core Features & Use Cases
- Declarative Signatures: Define inputs and outputs for tasks like question answering, summarization, and information extraction.
- Modular Reasoning Pipelines: Compose predictors and reasoning modules such as Predict, ChainOfThought, ReAct (tool-using), and ProgramOfThought (code-based).
- Automatic Prompt Optimization for RAG and Agents: Use optimizers to compile better prompting strategies from examples, including RAG workflows and reranking approaches.
Example use case: You have a dataset of user questions with expected answers and you want a RAG agent that retrieves relevant passages, generates answers, and improves accuracy via an optimizer-driven evaluation loop.
Quick Start
Configure DSPy with your chosen LLM and create a signature-based QA predictor, then run it on a question to get an answer.