Chat UIs, RAG & agentsMITPython

DSPy

Program — not prompt — language models, then optimize automatically.

Stars
39.3K
Forks
3.6K
Open issues
864
Last commit
2026-11-29

Live from the GitHub API · updated 2026-11-30

What is DSPy?

DSPy from Stanford NLP replaces hand-written prompts with declarative modules and signatures. Optimizers then tune prompts and few-shot examples (or fine-tune weights) against a metric, making LLM pipelines more reliable and portable across models.

Key features

  • Declarative signatures and modules
  • Prompt and weight optimizers
  • Works with any LLM provider
  • Built-in RAG, ReAct and chain-of-thought modules

System requirements

Platforms
Windows · macOS · Linux
Python
3.10+

How to install DSPy

Summarized from the project’s README. Projects change quickly — check the GitHub page for the latest instructions.

pip

  1. 1
    Install the library.
    pip install -U dspy

Strengths

  • Systematic prompt optimization
  • Research-backed

Limitations

  • Different mental model from prompt engineering

DSPy alternatives compared

SoftwareStarsLicensePlatformsVRAM
DSPy

Program — not prompt — language models, then optimize automatically.

39.3KMIT—
LangChain

The most widely used framework for building LLM applications.

150.2KMIT—
LlamaIndex

Data framework for connecting LLMs to your documents.

53.1KMIT—
Haystack

Framework for production RAG, search and agent pipelines.

27.1KApache-2.0—
Open WebUI

Self-hosted ChatGPT-style interface for Ollama and OpenAI-compatible APIs.

159.8KOpen WebUI License (BSD-3-Clause based)—
LibreChat

Open-source ChatGPT clone supporting every major AI provider.

47.7KMIT—

FAQ

Is DSPy free?

Yes — DSPy is open-source software released under the MIT license. Check the license (and any model weight licenses) before commercial use.

Does DSPy run on Windows, Mac and Linux?

DSPy supports: Windows, macOS, Linux.

How do I install DSPy?

1. Install the library.

What are the best DSPy alternatives?

Popular alternatives include LangChain, LlamaIndex, Haystack, Open WebUI. See the comparison table on this page.