List your AI tool on AI Orion for free. Submit a tool

DSPy

DSPy: The framework for programming—not prompting—language models

Pricing
Free
DSPy

About DSPy

DSPy is a framework for programming, rather than prompting, language models, developed at Stanford NLP. It is built for developers who want to iterate quickly on modular AI systems, from simple classifiers to sophisticated RAG pipelines and agent loops. DSPy stands for Declarative Self-improving Python, and instead of writing brittle prompts, a developer writes compositional Python code that DSPy uses to teach a language model to deliver high-quality outputs.

A developer installs DSPy with pip install dspy, or installs the latest version directly from the main branch on GitHub. The current language model integration uses bundled native engines without a LiteLLM runtime dependency or fallback, and a migration guide documents breaking changes to provider options, custom language models, text completions, and embeddings. DSPy compiles declarative language model calls into self-improving pipelines, offering algorithms that optimize both prompts and weights automatically.

DSPy's research underpins techniques such as GEPA reflective prompt evolution, optimizing instructions and demonstrations for multi-stage language model programs, combining fine-tuning with prompt optimization, treating prompts as auto-optimized training hyperparameters, and using in-context learning for extreme multi-label classification. The framework also supports DSPy Assertions, which add computational constraints for self-refining language model pipelines, and originates from the Demonstrate-Search-Predict approach to composing retrieval and language models for knowledge-intensive NLP tasks.

DSPy is released under the MIT license and documented at dspy.ai, with a Discord server and GitHub repository for community support and contributions. Users who switch to the current native language model integration should consult the LM migration guide, since it changes how provider options, custom language models, text completions, and embeddings are configured compared to the previous LiteLLM-based setup. The project credits a team of Stanford researchers and asks users who publish research based on DSPy to cite the papers.

Use cases

  • Building a classifier or RAG pipeline without hand-tuned prompts
  • Writing research-grade, self-improving LM pipelines

Key features

  • Programs language models with compositional Python instead of prompts
  • Optimizes both prompts and model weights
  • Supports classifiers, RAG pipelines, and agent loops
  • GEPA reflective prompt evolution
  • DSPy Assertions for computational constraints on pipelines
  • Combines fine-tuning with prompt optimization
  • In-context learning for extreme multi-label classification
  • Compiles declarative LM calls into self-improving pipelines
  • Native LM engines without a LiteLLM dependency

Pros and cons

Pros

Free and open source under the MIT license
Backed by published research and multiple papers

Pricing

DSPy
Free
  • MIT license
  • Open source

Reviews

Loading reviews…

Alternatives to DSPy