DSPy
DSPy is a framework for programming—rather than prompting—language models, enabling developers to build modular AI systems and optimize their prompts and weights. It solves the problem of brittle prompts by allowing compositional Python code that teaches LMs to deliver high-quality outputs. It is for developers building classifiers, RAG pipelines, or agent loops.
🎬 From One-Shot to Agentic: Optimizing Shop Intelligence with DSPy @ Shopify Scale · cmpnd
✨ Key features
- Declarative self-improving Python framework for LMs
- Algorithms for optimizing prompts and weights
- Supports simple classifiers to sophisticated RAG pipelines
- Supports agent loops
- Fast iteration on modular AI systems
🎯 Use cases
- Building simple classifiers
- Building sophisticated RAG pipelines
- Building agent loops
- Optimizing prompts and weights for LM programs
📦 Installation
🧰 Requirements: Python environment with pip; no specific OS or API keys mentioned.
pip install dspy
To install the very latest from main:
pip install git+https://github.com/stanfordnlp/dspy.git
⚠️ Good to know
No limitations or project status stated in the README.
❓ FAQ
What does DSPy stand for?
DSPy stands for Declarative Self-improving Python.
How do I install DSPy?
You can install it via pip with pip install dspy, or install the latest from main with pip install git+https://github.com/stanfordnlp/dspy.git.
Where can I find the documentation?
The official documentation is available at dspy.ai.
What is the core idea behind DSPy?
Instead of brittle prompts, you write compositional Python code and use DSPy to teach your LM to deliver high-quality outputs.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.