DSPy logo

DSPy

Free tier

The framework for programming—not prompting—language models

Free·All audiences·Open source

Key strengths

Programming (not prompting) language modelsModular AI system composition in PythonAutomatic prompt and weight optimizationSupports classifiers, RAG pipelines, and agent loopsDeclarative Self-improving Python (DSPy) paradigm
Completely free
Founded 2022
Self-hostable
No ratings yet

DSPy is distributed as an open-source Python library under the MIT license and can be installed via pip. Key architectural concepts include:

  • Signatures — declarative input/output type definitions that describe a task without specifying how to prompt the model.
  • Modules — composable building blocks (e.g., dspy.Predict, dspy.ChainOfThought, dspy.ReAct) that implement reasoning strategies.
  • Optimizers — algorithms that automatically optimize prompt instructions and/or model weights given a training set and a metric function.
  • Self-hostable — works with any LM backend you control; no vendor lock-in.

The framework follows the Declarative Self-improving Python (DSPy) paradigm, enabling reproducible, programmatic AI pipelines.