Skip to content
New this week26 prompts for Sora, Veo and Runway video workflows.
Explore video prompts→
AIPrompt123Prompt library

Search AIPrompt123

Search prompts, categories, platforms and repositories

LLM frameworksPythonMIT

stanfordnlp/dspy

DSPy treats prompts and pipeline components as programs that can be compiled and optimised against examples and a metric. It is a strong fit when you have evaluation data and want systematic prompt improvement rather than hand-tuning. The abstraction shift is significant but pays off in repeatability.

28.0k stars2.4k forks260 contributors190 open issuesUpdated

What it does

  • Defines LLM modules and pipelines declaratively.
  • Optimises prompts and few-shot examples against a metric.
  • Supports retrieval and tool use as composable modules.

Key features

  • Metric-driven prompt optimisation.
  • Multiple optimisers and teleprompters.
  • Provider-agnostic model interface.
  • Evaluation harness.

How to install it

Commands are copied from the project documentation at the time of review. Check the repository for the current version.

Python
pip install dspy

Alternatives to consider

dspy is a strong default for llm frameworks, but the right choice depends on your stack, licence constraints and how much control you need. These are the projects we compare most often.

LangChainPromptfooGuidance

Prompts that pair with it

All prompts →
Verified Knowledge · FAQ

dspy FAQ

Adoption questions we hear most often about this project.

Related repositories

LLM frameworks · Python

A framework for composing LLM applications from models, tools, retrievers and memory.

118.0k19.2kMIT

LLM frameworks · C#

Microsoft's SDK for integrating LLMs into C#, Python and Java applications.

26.0k4.1kMIT

LLM frameworks · TypeScript

A TypeScript toolkit for building AI applications with streaming, tools and UI hooks.

18.0k2.9kApache-2.0