DSPy

Stanford's framework for programming — not prompting — language models, with automatic prompt optimization

Visit DSPy →
AI & AgentsFeaturedNew
TopicsPrompt OptimizationLLMResearch

DSPy takes a different approach to building with LLMs than most frameworks: instead of hand-writing and hand-tuning prompt strings, you define the structure of a task in Python code, and DSPy’s compiler automatically generates and optimizes the underlying prompts against a metric you specify.

Originating from Stanford NLP research, it’s aimed at developers frustrated by how brittle manually-tuned prompts become as a model or task changes — DSPy treats prompt engineering as an optimization problem to be solved programmatically rather than a craft to be practiced by trial and error.