3.0.0b3

stanfordnlp/dspy3.0.0b3Jul 19, 2025by okhat

AI Summary

Beta release introducing dspy.Code, PEP 604 unions, and async support via dspy.syncify.

Key Highlights

  • Introduced dspy.Code for code generation.
  • PEP 604 union types support in signatures.
  • Token streaming support for XMLAdapter.
  • dspy.syncify for running optimizers on async programs.

New Features

  • dspy.Code module.
  • PEP 604 union types.
  • Token streaming for XMLAdapter.
  • dspy.syncify.

Full Release Notes

## What's Changed

Key bugfix: The removal of `datasets` from the default dependencies in 3.0.0b1 meant that if the user didn't have `datasets` installed, the bootstrapping of MIPROv2 would fail silently, leading to worse optimization. Added `datasets` back in commit [8aa065945](https://github.com/stanfordnlp/dspy/commit/8aa0659451a1f44c60b213b7321563a1f677db1e).

Signatures, Adapters, & Types
* add dspy.Code by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8511
* Provide language to dspy.Code by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8519
* Use collections for type hints by @TomeHirata in https://github.com/stanfordnlp/dspy/pull/8513
* Add testing for PEP604 union types by @erandeutsch in https://github.com/stanfordnlp/dspy/pull/8475
* Fix type annotation for ensure_signature by @grisaitis in https://github.com/stanfordnlp/dspy/pull/8496
* Use model_dump instead of dict by @TomeHirata in https://github.com/stanfordnlp/dspy/pull/8493
* Fix native function calling in adapters by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8479
* Rename dspy.BaseType to dspy.Type by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8510
* Resolve "$def" for nested tool arg type by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8534
* Add token streaming support for XMLAdapter by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8478

Modules
* Update python_interpreter.py by @nillwyc in https://github.com/stanfordnlp/dspy/pull/8501
* unwrap pyodide object correctly by @arnavsinghvi11 in https://github.com/stanfordnlp/dspy/pull/8466
* Provide a `dspy.syncify` so that users can run optimizer on async dspy programs by @chenmoneygithub in https://github.com/stanfordnlp/dspy/pull/8509
* fix UnicodeDecodeError: 'gbk' codec can't decode by @nillwyc in https://github.com/stanfordnlp/dspy/pull/8522

Other
* Support MIPROv2 user confirmation in windows by @TomeHirata in https://github.com/stanfordnlp/dspy/pull/8485
* Run unit tests with real LLM calls by @TomeHirata in https://github.com/stanfordnlp/dspy/pull/8486


## New Contributors
* @LukasMurdock made their first contribution in https://github.com/stanfordnlp/dspy/pull/8477
* @ken-dwyer made their first contribution in https://github.com/stanfordnlp/dspy/pull/8474
* @grisaitis made their first contribution in https://github.com/stanfordnlp/dspy/pull/8496
* @vacmar01 made their first contribution in https://github.com/stanfordnlp/dspy/pull/8499
* @fswair made their first contribution in https://github.com/stanfordnlp/dspy/pull/8498
* @nillwyc made their first contribution in https://github.com/stanfordnlp/dspy/pull/8501
* @asad-aali made their first contribution in https://github.com/stanfordnlp/dspy/pull/8512
* @niklovescoding made their first contribution in https://github.com/stanfordnlp/dspy/pull/8515
* @MaximeRivest made their first contribution in https://github.com/stanfordnlp/dspy/pull/8527
* @brenorb made their first contribution in https://github.com/stanfordnlp/dspy/pull/8542

**Full Changelog**: https://github.com/stanfordnlp/dspy/compare/3.0.0b2...3.0.0b3