What is DSPy?
DSPy is an open-source Python framework for programming language models rather than relying on manually written prompts. DSPy stands for Declarative Self-improving Python and supports developers and researchers building modular AI systems. The project describes a programming approach based on compositional Python code, paired with algorithms that optimize prompts and model weights. DSPy is published in the stanfordnlp/dspy GitHub repository under the MIT license.
DSPy connects its framework documentation with research on language model programs. The repository links papers covering prompt optimization, fine-tuning, multi-stage programs, and retrieval combined with language models. Readers seeking usage guidance are directed to dspy.ai, while readers seeking the underlying research can follow the papers listed in the repository.
What DSPy can do
DSPy supports building language model applications as modular programs. The repository names simple classifiers, sophisticated retrieval-augmented generation pipelines, and agent loops as examples. DSPy combines this programming approach with algorithms for optimizing prompts and weights, giving developers a way to iterate on language model systems through code rather than treating prompt writing as the primary interface.
- DSPy expresses language model programs in compositional Python code.
- DSPy provides algorithms for optimizing prompts.
- DSPy provides algorithms for optimizing model weights.
- DSPy supports building classifiers.
- DSPy supports building RAG pipelines and agent loops.
How DSPy works
DSPy users write compositional Python code to define language model programs and use the framework to improve model outputs. Installation is available through pip install dspy, with a separate GitHub installation command for the latest code from the main branch. The current language model integration uses bundled native lm15 engines, without a LiteLLM runtime dependency or fallback.
Who DSPy is for
DSPy serves developers working in Python and researchers studying language model systems. The stated applications span classification, retrieval-augmented generation, and agent loops, making the framework relevant to people composing language model calls into larger programs. DSPy also provides a research reading list and citation information for people using the framework in academic work.
- DSPy helps developers build classifiers around language models.
- DSPy supports developers composing retrieval and generation pipelines.
- DSPy supports researchers investigating language model program optimization.
DSPy licensing and access
DSPy is available as an MIT-licensed open-source project through its public GitHub repository. The repository provides installation commands for the packaged release and the latest main-branch code, rather than presenting subscription plans for DSPy. Documentation is hosted at dspy.ai, and the project directs users to GitHub and Discord for community discussion, help, and contributions.
DSPy strengths and limitations
DSPy combines modular Python programming with optimization of both prompts and weights, and the repository names several distinct application types. The MIT license, installation instructions, documentation, and community channels support access to the project. DSPy nevertheless requires programming work, and the current language model integration has migration considerations: the repository explicitly directs users to a guide covering breaking changes.
- DSPy requires writing Python code to build language model programs.
- DSPy documents breaking changes to provider options, custom language models, text completions, and embeddings.
- DSPy has no LiteLLM runtime fallback in the current integration.
DSPy FAQ
What is DSPy?
DSPy is an open-source framework for programming language models with compositional Python code. DSPy stands for Declarative Self-improving Python and provides algorithms for optimizing prompts and model weights in modular AI systems.
Is DSPy free?
DSPy is available as an MIT-licensed open-source project on GitHub. DSPy can be installed through pip or directly from the repository, and the supplied repository text does not list DSPy subscription plans.
What can you use DSPy for?
DSPy supports building simple classifiers, retrieval-augmented generation pipelines, and agent loops. DSPy also provides algorithms for optimizing prompts and model weights while developers iterate on modular language model programs.
How do you install DSPy?
DSPy can be installed with pip install dspy. DSPy also provides pip install git+https://github.com/stanfordnlp/dspy.git for installing the latest code from the main branch, with usage documentation available at dspy.ai.
Does DSPy use LiteLLM?
DSPy currently uses bundled native lm15 engines for language model integration, without a LiteLLM runtime dependency or fallback. DSPy links a migration guide covering breaking changes to provider options, custom language models, text completions, and embeddings.
From the community
No reviews yet
Be the first to review this tool. What you write helps the next person choose.




