AI and models · Edition No. 21 · 15 Sep 2026

stanfordnlp/dspy

It improves the instructions you send a language model by measuring the answers instead of guessing.

← AI and modelsRead the whole edition →

36.7k stars · MIT · 3.3.1 (2026-08-21), GitHub and PyPI agree · Track this in Scout

It improves the instructions you send a language model by measuring the answers instead of guessing.

Repo detailsthe review · specs · pros & cons · install

What it is

A Python framework for building applications on language models. You declare typed input and output signatures and compose them into modules, and DSPy compiles those into prompts. Its optimisers then search over instruction wordings and few-shot examples against a metric you define, so the program is tuned rather than hand-edited.What it is good for. Anyone whose product depends on a model behaving consistently. The problem it removes is a real one: prompt quality is usually managed by feel, and feel does not survive a model upgrade. For Grasppy, whose whole value is that the subtopics it pulls out of a long conversation are the right ones, this is the tool that turns "these subtopics look better" into a number you can defend. It sits beside Instructor (Edition 5 #11), which shapes the output, and Ragas (Edition 14 #10), which scores it.

Stars36.7k
LicenceMIT
Latest3.3.1 (2026-08-21), GitHub and PyPI agree
Good
  • You write Python, not prompt strings, so the logic is testable and readable a month later.
  • Changing model changes one line. The optimiser re-tunes for the new model instead of you starting again.
  • MIT, very actively developed, and the documentation is unusually good.
Watch for
  • Every optimisation run makes many model calls, and those calls cost real money. Set a budget before the first run.
  • There is a genuine concept to learn first. Expect a day before it clicks, not an hour.
  • You have to write a scoring function, and if that score does not match what you actually want, the optimiser will cheerfully improve the wrong thing.
Similar repositories
  • 567-labs/instructor

    Makes a model return data that matches a schema you define, validating and retrying until it fits, which is the shaping half of the job where DSPy is the tuning half.

    Track this in Scout
  • BoundaryML/baml

    A small language in which you declare model functions and their output types, generating typed client code for several languages; it covers structure and types rather than automatic tuning.

    Track this in Scout
  • guidance-ai/guidance

    Constrains the model as it generates, interleaving your fixed text with patterns the output must match, so the answer cannot come back malformed in the first place.

    Track this in Scout
Install
python3 -m venv venv && source venv/bin/activate
pip install dspy
# Python 3.10 or newer is required (and below 3.15).
# The older package name dspy-ai is now only an alias. Install dspy.
Screenshots
stanfordnlp/dspy: GitHub preview card

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.