DSPy
AI & LLMsDSPy: The framework for programming—not prompting—language models
Release History
View all versions →3.3.1Breaking12 fixes16 featuresDSPy 3.3.1 introduces significant improvements to `PythonInterpreter`, including managed runtime installation, enhanced isolation, and lifecycle visibility. The release also boosts optimizer throughput with GEPA 0.1.4, enhances adapter reliability, and ensures MCP SDK v2 compatibility.
3.3.0Breaking5 fixes7 featuresDSPy 3.3.0 introduces Flex for experimental program structure optimization and ReActV2 for native tool-calling. It also advances towards a typed, provider-neutral LM system and decouples LiteLLM.
3.3.0b1Breaking1 fix6 featuresDSPy 3.3.0b1 introduces the experimental ReActV2 module and moves towards a typed, provider-neutral LM boundary contract. This release also makes NumPy optional in the base install and updates GEPA integration to 0.1.1.
3.2.12 fixesDSPy 3.2.1 focuses on bug fixes, particularly around async streaming and embedding calls, and includes numerous documentation and CI/CD improvements. The upper bound constraint on the litellm dependency has been removed.
3.2.026 fixes9 featuresThis 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.
3.1.3Breaking8 fixes3 featuresThis release focuses on stabilizing RLMs, particularly around tool usage and message parsing, and updates the GEPA dependency to include bug fixes and cached eval support. A previously planned feature regarding native reasoning was reverted.
3.1.22 fixes1 featureThis maintenance release includes fixes for JSON parsing and RAG tutorial downloads, and exposes new configuration options for the Parallel module.
3.1.1Breaking19 fixes6 featuresThis release introduces the RLM Module, enhances GEPA for multi-agent systems, and includes numerous bug fixes across adapters, maintenance, and documentation.
3.1.0Breaking12 fixes12 featuresDSPy 3.1.0 officially releases the beta, adding new adapters, file handling, reasoning support, Python 3.14 compatibility, and several optimizer and security enhancements, while fixing numerous bugs and renaming the settings API.
3.1.0b112 fixes8 featuresDSPy 3.1.0b1 introduces several new features such as a File type, Reasoning capture, and Python 3.14 support, along with numerous bug fixes and security hardening, while renaming configuration helpers.
3.0.436 fixes25 featuresDSPy 3.0.4 adds extensive GEPA enhancements, new Anthropic citation support, tool execution improvements, and numerous bug fixes while deprecating Image.from_* helpers.
3.0.4b213 fixes4 featuresThis release adds new tooling APIs, improves networking headers, and introduces several bug fixes and documentation updates.
3.0.4b1Breaking28 fixes18 featuresDSPy 3.0.4b1 adds extensive GEPA enhancements, multimodal support, and new documentation, while introducing breaking changes to DummyLM, EvaluationResult location, and deprecating Image.from_* helpers.
3.0.3Breaking4 fixes5 featuresdspy 3.0.3 adds rollout_id support, improves GEPA optimizer, updates caching behavior, and includes several bug fixes and maintenance updates.
3.0.23 fixes5 featuresThis 3.0.2 release adds support for custom chunk types, OpenAI response API, and gpt-5‑nano reasoning models, while fixing mlflow‑GEPA integration, BAMLAdapter issues, and an error‑message typo. It also introduces deprecation warnings for requires_permission_to_run and adds type hints for Module call methods.
3.0.12 fixes6 featuresVersion 3.0.1 introduces ConfigDict-based config, lazy gepa imports, improved error handling, flexible ToolCalls parsing, and several bug fixes.
3.0.0Breaking7 fixes13 featuresDSPy 3.0 introduces powerful new optimizers, extensible adapters and types, async execution, and native MLflow 3.0 observability, while removing community retrievers, dropping Python 3.9 support, and cleaning up legacy APIs.
3.0.0b49 fixes8 featuresThis release adds several optimizer and adapter improvements, introduces new features like a custom BAMLAdapter and a gpt-5 reasoning model flag, and includes numerous bug fixes and maintenance updates.
3.0.0b37 fixes9 featuresVersion 3.0.0b3 restores the `datasets` dependency, adds several new features such as `dspy.Code`, token streaming for XMLAdapter, and `dspy.syncify`, and includes numerous bug fixes and API refinements.
3.0.0b2Breaking11 fixes18 featuresDSPy 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.
3.0.0b1Breaking8 fixes4 featuresThis release introduces several bug fixes, style standardization, and new features like a global max_errors setting. The main breaking change is the removal of unmaintained retriever integrations.
2.6.271 fixVersion 2.6.27 fixes the BaseType annotation parsing issue.
2.6.27a11 fixThis patch fixes the BaseType annotation parsing issue.
2.6.262 fixes1 featureThis release adds support for dspy.Tool and dspy.ToolCall field types and includes bug fixes for inspect_history and linting issues.
2.6.2511 fixes14 featuresDSPy 2.6.25 introduces several new features such as a custom Signature base class, Audio handling, CodeAct module, and Python 3.13 support, along with numerous bug fixes and improvements.
Common Errors
BadRequestError11 reportsBadRequestError in dspy often arises from incorrect API usage, such as malformed requests, exceeding token limits, or unsupported model parameters. To fix it, carefully review your dspy program, ensuring your prompts respect the model's input format, the context length is within limits, and all specified parameters are valid for the chosen model. Inspect the detailed error message for specifics to guide adjustments.
AdapterParseError4 reportsAdapterParseError in dspy usually stems from the language model's response not conforming to the expected format specified by the adapter (e.g., JSON). Carefully inspect the LM's output and adjust your dspy.Signature or adapter configuration to accurately reflect the actual response structure, potentially using custom parsing logic if needed. Employ techniques like response cleaning (e.g., removing extraneous text) or more permissive parsing to handle variations in the LM's output.
ContextWindowExceededError3 reportsThe ContextWindowExceededError in dspy arises when the input prompt plus generated output surpasses the language model's maximum token limit. Fix this by shortening input prompts (e.g., reduce context or examples provided), reducing the maximum length of generated responses using `max_tokens`, and employing techniques like summarization to compress information.
CodeInterpreterError3 reportsCodeExecutionError2 reportsThe CodeExecutionError in dspy often arises from issues with how Python interpreters serialize and deserialize data, particularly with large integers exceeding JavaScript's safe integer limit (2**53) or non-JSON-safe values like NaN and Infinity. To fix this, ensure all data passed to or returned from the interpreter is strictly JSON-serializable, which may involve casting large integers to strings or representing NaN/Infinity with null or a specific sentinel value recognized by your application logic.
TypeError2 reportsThe "TypeError: object of type 'int' has no len()" in dspy often arises when a function expects a sequence-like object (e.g., list, string) but receives an integer instead, particularly when dealing with usage tracking data or model outputs where length is being calculated. To fix this, ensure that the function receives the expected data type by either converting the integer to a string or list (if appropriate) or verifying the logic that produces the integer value in the first place. Check for incorrect assumptions or data types during usage entry merging or when handling Anthropic model responses.
Related AI & LLMs Packages
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Get up and running with OpenAI gpt-oss, DeepSeek-R1, Gemma 3 and other models.
🦜🔗 The platform for reliable agents.
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
LLM inference in C/C++
GPT4All: Run Local LLMs on Any Device. Open-source and available for commercial use.
Subscribe to Updates
Get notified when new versions are released