Change8

3.2.0

📦 dspyView on GitHub →
9 features🐛 26 fixes1 deprecations🔧 19 symbols

Summary

This release introduces significant decoupling from LiteLLM by moving capability checks to BaseLM and introducing a DSPy-owned error type, while also enhancing optimizer chaining with BetterTogether. Security and stability improvements were made across RLM, PythonInterpreter, and cache handling, including an opt-in restricted pickle mode for disk cache.

Migration Steps

  1. If you implemented custom BaseLM backends, ensure they utilize the new capability properties and raise dspy.ContextWindowExceededError instead of relying on litellm errors.
  2. If using Optuna features like MIPROv2 or BootstrapFewShotWithOptuna, install it explicitly via 'pip install dspy[optuna]'.
  3. If you rely on cache loading being permissive, consider calling dspy.configure_cache(restrict_pickle=True) if you encounter issues, as future versions may restrict pickle loading by default.

✨ New Features

  • BetterTogether now accepts arbitrary optimizers as keyword arguments and chains them via strategy strings (e.g., strategy="p -> w -> p").
  • BaseLM now exposes capability properties (supports_function_calling, supports_reasoning, supports_response_schema, supported_params) to facilitate decoupling from LiteLLM.
  • New dspy.ContextWindowExceededError replaces the litellm error throughout the system.
  • Added verify parameter to Image for SSL bypass.
  • Added type validation for input fields in signatures, logging a warning on type mismatch or extra fields.
  • Added file output support to inspect_history.
  • Optuna is now optional; install via 'pip install dspy[optuna]'.
  • Added EmbeddingsWithScores for similarity score access in retrievers.
  • Added XMLAdapter to dspy.ai.

🐛 Bug Fixes

  • Skipped JSON schema for DSPy custom types in prompt.
  • Fixed ColBERTv2RetrieverLocal forward method variable scoping bug.
  • Removed code corruption in ProgramOfThought._parse_code.
  • RLM now shows head and tail for RLM outputs.
  • Changed RLM repl_variable preview to 1000 chars.
  • SemanticF1 and CompleteGrounded now return dspy.Prediction.
  • Enhanced code fence parsing and REPL entry formatting in RLM.
  • Fixed false rollout_id warning when LM temperature is unset.
  • Passed metric_threshold to BootstrapFewShot for unshuffled case.
  • Only suggest reducing valset in GEPA when it is large.
  • DummyLM now delegates to forward() instead of overriding __call__.
  • Evaluation now runs on the main thread when num_threads=1.
  • Blocked unsafe LM loading keys during saving.
  • Added allow_pickle flag to settings loading.
  • Hardened JSONRPC communication and tool bridge in the interpreter.
  • Reset tools/mounts when Deno subprocess restarts.
  • Passed use_native_function_calling in JSONAdapter.acall.
  • Raise AdapterParseError on empty LM response instead of silent None.
  • Rejected duplicate input and output field names in signatures.
  • Guarded annotation subclass checks for ReAct tool args.
  • Ensured JSON serialization handles diacritics correctly for Pydantic BaseModel in JSONAdapter.
  • Preserved per-message structure in Responses API conversion.
  • Fixed cloudpickle serialization of Signature on Python 3.14.
  • Corrected demo index assignment in MIPROv2 raw_chosen_params.
  • Fixed cache bugs: os.fspath(None) crash, double disk lookups, lazy logging.
  • Guarded response.usage access to handle missing usage field in BaseLM.

Affected Symbols

⚡ Deprecations

  • Deprecation warning for prefix, format, and parser kwargs in InputField/OutputField.