Change8

3.0.0b2

Breaking Changes
📦 dspyView on GitHub →
8 breaking18 features🐛 11 fixes🔧 12 symbols

Summary

DSPy 3.0.0b2 introduces new LM providers, async adapters, and extensive cleanup, but also removes several legacy APIs and drops Python 3.9 support, requiring code updates.

⚠️ Breaking Changes

  • Removed the dspy.Program alias; code importing or referencing dspy.Program will fail. Replace with the new class or import path as documented.
  • Changed the output interface of evaluate; callers must adapt to the new return structure.
  • Removed the Hyperparameter class; any usage must be replaced with the new configuration approach.
  • Removed the experimental module and several unused files; imports from these modules will break.
  • Renamed modules to singular "module" and moved internal_dspy outside the dspy package; update import statements accordingly.
  • Moved dsp/metrics into evaluate/metrics; adjust imports to the new location.
  • Dropped Python 3.9 support; upgrade to Python >=3.10.
  • Removed dspy.settings related to dspy.Assertion; code relying on these settings must be updated.

Migration Steps

  1. Update imports: replace any `dspy.Program` usage with the new class or module as per the updated docs.
  2. Adjust code that calls `evaluate` to handle the new output interface.
  3. Remove references to the deprecated `Hyperparameter` class and adopt the new configuration pattern.
  4. Update import paths for moved modules, e.g., import from `evaluate.metrics` instead of `dsp.metrics` and from `module` instead of the old module names.
  5. Modify imports that referenced `internal_dspy` now located outside the `dspy` package.
  6. Remove or replace any usage of the experimental module and deleted settings related to `dspy.Assertion`.
  7. If using the StreamListener, ensure you reuse it according to the new API.

✨ New Features

  • Added a format field to ToolCalls.
  • Allowed reusing the StreamListener.
  • Supported async paths for ChatAdapter and JSONAdapter.
  • Added Gemini as an LM provider.
  • Changed the default model to llama-4 for the Databricks provider.
  • Added real-world tutorial for email extraction.
  • Documented comparison operations of dspy.Prediction.
  • Added support for PEP 604 union types in inline signatures.
  • Added a real-world example with Yahoo Finance LangChain tool.
  • Added a memory-agent tutorial.
  • Added a real-world example overview page.
  • Added a tutorial for a text-based game.
  • Added a tutorial for generating code examples from documentation.
  • Added a llms.txt generation tutorial.
  • Improved error messages on invalid LM setup.
  • Showed a warning when forward is called directly.
  • Added missing hooks to the observability tutorial.
  • Added a tutorial on customizing modules.

🐛 Bug Fixes

  • Fixed StreamListener stripping out space after the start identifier.
  • Fixed the streaming test.
  • Fixed Bedrock streaming token tracking.
  • Allowed exceptions to pass through in JSONAdapter.
  • Fixed PEP 604 union types when using Class Signatures for ChainOfThought.
  • Improved error message on invalid LM setup.
  • Fixed the error that status message streaming was blocking.
  • Fixed signature input type.
  • Fixed lint issues.
  • Fixed mkdoc warnings.
  • Fixed typo.

🔧 Affected Symbols

dspy.ProgramevaluateHyperparameterinternal_dspydsp.metricsChainOfThoughtWithHintToolCalls.formatStreamListenerJSONAdapterChatAdapterdspy.settings.Assertiondspy.Prediction