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 an open-source Python framework (MIT license, ~38,500 GitHub stars) that replaces hand-crafted prompt strings with declarative, composable modules for programming language models. Instead of brittle prompt templates, developers define typed signatures and chain modules (e.g., dspy.ChainOfThought, dspy.ReAct) into pipelines. DSPy's optimizers (formerly "teleprompters") then automatically tune prompts and/or fine-tune weights against a metric, eliminating manual prompt engineering. It supports classifiers, retrieval-augmented generation (RAG) pipelines, and multi-step agent loops. Installable via pip install dspy-ai; self-hostable with any compatible LM backend.