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
- 1Install the library.
pip install -U dspy
Strengths
- Systematic prompt optimization
- Research-backed
Limitations
- Different mental model from prompt engineering
DSPy alternatives compared
| Software | Stars | License | Platforms | VRAM |
|---|---|---|---|---|
| DSPy Program — not prompt — language models, then optimize automatically. | 39.3K | MIT | — | |
| LangChain The most widely used framework for building LLM applications. | 150.2K | MIT | — | |
| LlamaIndex Data framework for connecting LLMs to your documents. | 53.1K | MIT | — | |
| Haystack Framework for production RAG, search and agent pipelines. | 27.1K | Apache-2.0 | — | |
| Open WebUI Self-hosted ChatGPT-style interface for Ollama and OpenAI-compatible APIs. | 159.8K | Open WebUI License (BSD-3-Clause based) | — | |
| LibreChat Open-source ChatGPT clone supporting every major AI provider. | 47.7K | MIT | — |
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.