Heads up This site is currently under heavy development.
← all tools
◆ AI Agent Frameworks

DSPy

3.3.1 open-source

DSPy: The framework for programming—not prompting—language models

Summary

DSPy is an open-source AI agent framework that enables building modular AI systems by writing compositional Python code to optimize prompts and weights for language models. It is distributed as a library that gets installed via pip. This tool is designed for application developers looking to program model behavior rather than just prompt it. Its documentation positions it alongside other generative AI frameworks. The project maintains an active presence with papers published as recently as July 2025.

DSPy: The framework for programming—not prompting—language models

What DSPy answers

What kinds of AI systems can I build?

simple classifiers, sophisticated RAG pipelines, or Agent loops

How do I make the system perform better?

algorithms for optimizing their prompts and weights

What programming approach does it use?

writing compositional Python code

What kinds of existing knowledge bases does it benefit from?

it optimizes prompts and weights for language models

Does it require running code in a specific place?

it is distributed as a library that gets installed via pip

What state of development is the research backing it?

research papers are published as recently as July 2025

Release history

  1. 3.3.1 Aug 21, 2026 · issue 004

    DSPy 3.3.1 adds managed Deno runtime for PythonInterpreter, multi-proposal GEPA optimization, structured MCP results, and expanded callback lifecycle visibility.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.3.1 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.3.1
    └──▷ TRY IT
    Install the managed Deno runtime so PythonInterpreter works without a system Deno install.
    $ pip install "dspy[deno]"
    Run GEPA optimization with four concurrent proposals, strict-improvement acceptance, and best-candidate selection — all within a fixed thread budget of 8.
    python
    import dspy
    from gepa.strategies.proposal_sampling import IndependentSampling
    from gepa.strategies.proposal_selection import BestImprovement
    
    optimizer = dspy.GEPA(
        metric=metric,
        max_metric_calls=2_000,
        reflection_lm=dspy.LM("openai/gpt-5", temperature=1.0, max_tokens=32_000),
        num_threads=8,
        gepa_kwargs={
            "sampling_strategy": IndependentSampling(4),
            "selection_strategy": BestImprovement(),
            "acceptance_criterion": "strict_improvement",
        },
    )
    Return machine-readable structured content from an MCP tool call instead of the default text conversion.
    python
    tool = dspy.Tool.from_mcp_tool(client, mcp_tool, result_mode="structured")
    • Adds pip install 'dspy[deno]' optional extra to provide a managed Deno 2.x runtime for PythonInterpreter, pinning Pyodide and validating Deno >=2.0.0,<3.0.0 without requiring a system install.
    • Adds result_mode='structured' parameter to dspy.Tool.from_mcp_tool(), returning structuredContent from MCP SDK v2 servers (including arrays, scalars, empty values, and explicit JSON null) with fallback to existing content conversion.
    • Supports GEPA 0.1.4's multi-proposal contracts via gepa_kwargs, accepting keys sampling_strategy, selection_strategy, and acceptance_criterion to enable concurrent candidate evaluation within the existing num_threads budget.
    • Adds objective-aware frontier tracking in GEPA via gepa_kwargs, supporting objective_scores dimensions (quality, privacy, cost) for parent/merge selection while the scalar metric continues to gate acceptance.
    • Exposes full PythonInterpreter lifecycle events through DSPy's callback API: interpreter execution start/end, sandbox-to-host tool-call start/end, and interpreter process startup/shutdown — with callback ancestry retained across modules.
    +8 moreshow less
    • Adds PythonInterpreter.execution_instructions to give RLM an accurate description of the Pyodide environment, including state persistence and unavailable native process capabilities.
    • Extends optimizer compile() runs with start/end callback coverage, consistent with the interpreter lifecycle events.
    • Adds timeout parameter to Image.from_url() and Audio.from_url(), defaulting to 30 seconds; pass timeout=None to restore the previous unbounded behavior.
    • Supports MCP SDK v2 field names, v1 ClientSession, and v2 high-level Client in DSPy's MCP bridge, without changing default tool-result semantics.
    • XMLAdapter now formats and parses nested Pydantic models, typed dictionaries, lists, mappings, nullable fields, and unions as nested XML, while remaining backward-compatible with the previous JSON-inside-XML representation.
    • CodeInterpreterError is now also a DSPyError subclass while retaining RuntimeError compatibility, enabling unified catch blocks across interpreter and agent modules.
    • max_reflection_cost in DSPy's GEPA adapter now raises clearly when set instead of silently providing an ineffective budget.
    • Strengthens PythonInterpreter sandbox isolation: request IDs are unpredictable, recursive execution through host tools is rejected, Deno-cache access is revoked after startup, and guest code cannot mutate JavaScript globals or prototypes to change host-tool identity.
    └──▷ BREAKING ON UPGRADE
    • !dspy.CodeAct and dspy.ProgramOfThought now emit DeprecationWarning on construction and are scheduled for removal in DSPy 3.5; migrate to dspy.RLM.
    • !Image.from_url() and Audio.from_url() now default to a 30-second timeout instead of waiting indefinitely; code relying on unbounded download time must pass timeout=None explicitly.
  2. 3.3.0 Aug 3, 2026 · issue -016

    DSPy 3.3.0 adds Flex structure-optimizing programs, ReActV2 with native tool calling, and a typed provider-neutral LM boundary.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.3.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.3.0
    └──▷ USE IT
    Let GEPA discover the full program structure — not just prompts — for a QA task, then inspect and save the generated implementation.
    python
    import dspy
    
    program = dspy.Flex("question -> answer")
    optimized = dspy.GEPA(metric=metric, reflection_lm=reflection_lm).compile(
        program,
        trainset=trainset,
        valset=valset,
    )
    
    print(optimized.module_src)
    optimized.save("flex_qa.json")
    Catch LM errors in a provider-neutral way instead of depending on provider-specific exception classes.
    python
    import dspy
    
    try:
        result = lm(messages=[{"role": "user", "content": "Hello"}])
    except dspy.LMError as e:
        print(f"LM call failed: {e}")
    • Adds dspy.Flex, an experimental module that places program structure — predictors, control flow, DSPy primitives, and Python/LM balance — into the GEPA search space so the optimizer discovers decomposition instead of only tuning prompts; defaults to a single dspy.Predict baseline, or dspy.RLM when tools are supplied.
    • Adds max_predictor_calls guard on Flex-generated programs to prevent runaway LM usage in optimizer-authored code, and supports a program_trace argument to metrics so programs can be scored on how a result was produced (e.g. penalizing excessive LM calls).
    • Persists optimizer-discovered module_src as part of a Flex program's serialized state, so dump_state() / load_state() round-trips preserve the GEPA-authored implementation.
    • Adds dspy.ReActV2, an experimental ReAct implementation built on native tool calling, using dspy.History, dspy.Tool, and dspy.ToolCalls (which can optionally store dspy.ToolCallResults) instead of custom next_tool_args / trajectory syntax.
    • Adds parallel_tool_calls support to dspy.ReActV2, preserving each call/result pair by ID in both native and non-native mode.
    +12 moreshow less
    • Adds multi-turn native tool call support to dspy.ReActV2: prior tool calls and results are replayed as structured assistant and tool messages rather than being flattened into prompt text, enabling prompt-caching reuse of stable prefixes (observed up to 50% cost reduction in internal testing).
    • Introduces a typed, provider-neutral LM contract — def forward(self, request: dspy.LMRequest) -> dspy.LMResponse — that custom LM authors can implement instead of guessing at OpenAI/LiteLLM-shaped inputs; opt in with dspy.context(experimental=True).
    • Exports the typed LM API (dspy.LMRequest, dspy.LMResponse, dspy.LMToolCallPart) and supports typed direct calls through BaseLM.__call__.
    • Adds dspy.LMError (and narrower DSPy subclasses) as a provider-neutral exception type, replacing the need to catch provider-specific exception classes.
    • Adds BaseLM.dump_state() and BaseLM.load_state() for sanitized LM state serialization that excludes API keys, preserves legacy saved states, and requires explicit opt-in before importing trusted custom LM classes.
    • Makes LiteLLM imports lazy, decoupling the core LM API from a specific provider bridge at import time.
    • Makes optional-provider imports thread-safe.
    • Adds explicit factory methods Image.from_path(), Image.from_url(), Audio.from_path(), Audio.from_url(), File.from_path() as the new required API for resource loading, replacing implicit I/O on construction.
    • OpenAI Responses API path now emits Responses-native tool and tool_choice request shapes, with legacy Responses outputs using the same Chat-style tool-call representation as the Chat Completions path.
    • Makes numpy an optional install extra (pip install 'dspy[numpy]'), reducing the base install footprint; affected features include embeddings, KNN/KNNFewShot, SIMBA, and other NumPy-backed optimizer or retrieval paths.
    • Updates DspyGEPAResult to mirror gepa[dspy]==0.1.1 result shapes, making candidates and best_candidate return compiled DSPy modules; val_subscores, per_val_instance_best_candidates, best_outputs_valset, and highest_score_achieved_per_val_task all have updated types keyed by validation instance id.
    • Replaces reflection_prompt_template in dspy.GEPA gepa_kwargs with an instruction_proposer parameter for custom proposal behavior (passing reflection_prompt_template now raises a clear ValueError).
    └──▷ BREAKING ON UPGRADE
    • !Constructing dspy.Image, dspy.Audio, or dspy.File from a path or URL no longer reads or fetches the resource implicitly; use Image.from_path(), Image.from_url(), Audio.from_path(), Audio.from_url(), or File.from_path() instead.
    • !Image.from_url(..., download=...) and the download_images / verify options on encode_image() were removed; use an explicit factory or reference constructor instead.
    • !encode_image(path), encode_audio(path_or_url), and encode_file_to_dict(path) are replaced by Image.from_path(), Audio.from_path() / Audio.from_url(), and File.from_path() respectively.
    • !Image.from_file(), Image.from_PIL(), and Audio.from_file() are deprecated aliases scheduled for removal in 3.4; use Image.from_path(), Image(pil_image), and Audio.from_path() respectively.
    • !numpy is no longer installed with base dspy; code using embeddings, KNN/KNNFewShot, SIMBA, or other NumPy-backed paths will break unless pip install 'dspy[numpy]' is added.
    • !DspyGEPAResult.candidates now returns a list of compiled DSPy modules instead of instruction dictionaries, and DspyGEPAResult.best_candidate now returns a compiled DSPy module; code inspecting optimized_program.detailed_results must be updated.
    • !DspyGEPAResult fields val_subscores, per_val_instance_best_candidates, best_outputs_valset, and highest_score_achieved_per_val_task have new types keyed by validation instance id.
    • !GEPA 0.1.1 renamed default reflection template placeholders from <curr_instructions> / <inputs_outputs_feedback> to <curr_param> / <side_info>; custom templates using the old names must be updated.
    • !Passing reflection_prompt_template through gepa_kwargs in dspy.GEPA now raises a ValueError; use instruction_proposer instead.
    • !RLM.max_iterations is renamed to RLM.max_iters; code constructing dspy.RLM(max_iterations=...) will break.
  3. 3.3.0 Aug 3, 2026 · issue 002

    DSPy 3.3.0 adds Flex structure optimization, ReActV2 with native tool-calling, and a typed provider-neutral LM boundary.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.3.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.3.0
    └──▷ USE IT
    Let GEPA discover the best program structure for a Q&A task instead of hand-designing decomposition.
    python
    import dspy
    
    program = dspy.Flex("question -> answer")
    optimized = dspy.GEPA(metric=metric, reflection_lm=reflection_lm).compile(
        program,
        trainset=trainset,
        valset=valset,
    )
    
    print(optimized.module_src)  # inspect the implementation GEPA discovered
    Install NumPy-backed features (KNN, SIMBA, embeddings) now that numpy is an optional extra.
    $ pip install "dspy[numpy]"
    • Adds dspy.Flex, an experimental module that places program structure itself into the GEPA optimization search space, starting from a single dspy.Predict (or dspy.RLM when tools are supplied) and rewriting control flow, DSPy primitives, and the balance between Python and LM calls against a user metric; the discovered implementation is stored in optimized.module_src and preserved through save/load.
    • Adds max_predictor_calls guard to dspy.Flex-generated programs to prevent runaway LM usage in optimizer-authored code, and allows metrics to accept a program_trace argument to score how a result was produced.
    • Adds dspy.ReActV2, an experimental ReAct implementation built on native tool calling that uses dspy.History, dspy.Tool, and dspy.ToolCalls (optionally storing dspy.ToolCallResults) instead of the custom next_tool_args / trajectory syntax.
    • Adds parallel_tool_calls support in dspy.ReActV2, preserving each call/result pair by ID in both native and non-native mode.
    • Adds multi-turn native tool call support in dspy.ReActV2: prior tool calls and results are replayed as structured assistant and tool messages rather than flattened prompt text, enabling prompt-cache reuse and observed up to 50% cost reductions.
    +10 moreshow less
    • Introduces a typed, provider-neutral LM boundary via dspy.LMRequest / dspy.LMResponse and a BaseLM.forward(request: dspy.LMRequest) -> dspy.LMResponse contract; opt in with dspy.context(experimental=True).
    • Adds BaseLM.dump_state() and BaseLM.load_state() for sanitized LM-state serialization that strips API keys and preserves legacy saved states.
    • Adds dspy.LMError (and narrower DSPy subclasses) so callers can catch LM errors without depending on provider-specific exception classes.
    • Makes LiteLLM imports lazy, decoupling the core LM API from the LiteLLM provider bridge at import time.
    • Adds explicit Image.from_path(path), Image.from_url(url), Audio.from_path(path), Audio.from_url(url), File.from_path(path) factory methods that make I/O intent explicit, replacing implicit path/URL interpretation in constructors.
    • The OpenAI Responses API path now emits Responses-native tool and tool_choice request shapes, and typed LMToolCallPart objects preserve raw provider fields.
    • Makes numpy an optional extra (pip install 'dspy[numpy]'), keeping the base install lighter; required for embeddings, KNN/KNNFewShot, SIMBA, and other NumPy-backed optimizer or retrieval paths.
    • Updates DspyGEPAResult to mirror the gepa[dspy]==0.1.1 API: candidates and best_candidate are now compiled DSPy modules, val_subscores is list[dict[Any, float]] keyed by validation instance id, and best_outputs_valset is dict[Any, list[tuple[int, Prediction]]].
    • Adds a ValueError when reflection_prompt_template is passed via gepa_kwargs to dspy.GEPA, directing users to the instruction_proposer parameter for custom proposal behavior.
    • Adds RLM namespace validation that fails at construction time for duplicate tool names, Python-keyword tool names, and signature inputs that collide with built-in sandbox functions.
    └──▷ BREAKING ON UPGRADE
    • !Constructing dspy.Image, dspy.Audio, or dspy.File from a path or URL string no longer performs implicit I/O; use Image.from_path(), Image.from_url(), Audio.from_path(), Audio.from_url(), or File.from_path() instead.
    • !Image.from_url() now downloads and returns an embedded data URI; use Image(url) when the provider should fetch the URL reference without downloading.
    • !Image.from_url(..., download=...) and the download_images / verify options on encode_image() are removed.
    • !encode_image(path), encode_audio(path_or_url), and encode_file_to_dict(path) are replaced by Image.from_path(), Audio.from_path() / Audio.from_url(), and File.from_path() respectively.
    • !Image.from_file(), Image.from_PIL(), and Audio.from_file() are deprecated aliases scheduled for removal in 3.4; use Image.from_path(), Image(pil_image), and Audio.from_path() instead.
    • !numpy is no longer installed with base dspy; install pip install 'dspy[numpy]' to restore embeddings, KNN/KNNFewShot, SIMBA, and other NumPy-backed paths.
    • !DspyGEPAResult.candidates is now a list of compiled DSPy modules (not instruction dictionaries), DspyGEPAResult.best_candidate is a compiled DSPy module, val_subscores is list[dict[Any, float]], per_val_instance_best_candidates is dict[Any, set[int]], best_outputs_valset is dict[Any, list[tuple[int, Prediction]]], and highest_score_achieved_per_val_task is keyed by validation instance id.
    • !GEPA 0.1.1 renamed reflection template placeholders from <curr_instructions> / <inputs_outputs_feedback> to <curr_param> / <side_info>; custom templates using the old names must be updated.
    • !RLM.max_iterations is renamed to RLM.max_iters; code passing max_iterations= to the RLM constructor must be updated.
    • !RLM construction now raises an error for duplicate tool names, Python-keyword tool names, or signature inputs that collide with built-in sandbox functions.
  4. 3.2.0 Apr 21, 2026 · issue -120

    DSPy 3.2.0 chains optimizers in BetterTogether, decouples from LiteLLM, and adds type-mismatch warnings and safe cache deserialization.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.2.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.2.0
    └──▷ USE IT
    Chain prompt and weight optimization steps in sequence, falling back to the best result at each stage.
    python
    import dspy
    from dspy.teleprompt import BetterTogether, GEPA, BootstrapFinetune
    
    optimizer = BetterTogether(
        metric=my_metric,
        p=GEPA(metric=my_metric),
        w=BootstrapFinetune(metric=my_metric),
        strategy="p -> w -> p"
    )
    best_program = optimizer.compile(my_program, trainset=trainset, valset=valset)
    Enable safe cache deserialization to prevent arbitrary code execution from corrupted or malicious disk-cache files.
    python
    import dspy
    
    dspy.configure_cache(restrict_pickle=True)
    Silence type-mismatch warnings when you intentionally pass loosely-typed values to DSPy signatures.
    python
    import dspy
    
    dspy.configure(warn_on_type_mismatch=False)
    • Adds dspy.configure(warn_on_type_mismatch=False) to control new type-validation warnings that fire when a value passed to a signature field doesn't match its declared type (powered by typeguard); extra fields not in the signature also warn.
    • Adds dspy.configure_cache(restrict_pickle=True) to swap pickle.load with a restricted unpickler that only allows litellm/openai types, numpy reconstruction helpers, and user-registered safe_types, preventing arbitrary code execution from malicious cache files.
    • Adds verify parameter to Image for SSL bypass.
    • Adds EmbeddingsWithScores retriever for direct access to similarity scores alongside retrieval results.
    • Adds XMLAdapter to DSPy.
    +4 moreshow less
    • Adds file output support to inspect_history.
    • BetterTogether now accepts arbitrary optimizers as keyword arguments and chains them via strategy strings (e.g., BetterTogether(metric=m, p=GEPA(...), w=BootstrapFinetune(...)) with strategy='p -> w -> p'), evaluating each step on a valset and returning the best program.
    • BaseLM now exposes capability properties (supports_function_calling, supports_reasoning, supports_response_schema, supported_params) so custom backends integrate with DSPy's retry/truncation logic without any litellm dependency; dspy.ContextWindowExceededError replaces the litellm error throughout.
    • optuna is now an optional dependency installable via pip install dspy[optuna]; only MIPROv2 and BootstrapFewShotWithOptuna require it.
    └──▷ BREAKING ON UPGRADE
    • !optuna is no longer installed by default; workflows using MIPROv2 or BootstrapFewShotWithOptuna must now run pip install dspy[optuna] to restore the dependency.
  5. 3.1.2 Jan 19, 2026 · issue -210

    DSPy 3.1.2 exposes timeout and straggler_limit params in Parallel for finer execution control.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.1.2 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.1.2
    • Exposes timeout and straggler_limit parameters in Parallel to control execution time limits and straggler handling in parallel pipelines.
  6. 3.1.1 Jan 19, 2026 · issue -210

    DSPy 3.1.1 adds RLM module, GEPA tool-description optimization, StreamListener generic types, and DSPy settings save/load.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.1.1 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.1.1
    └──▷ USE IT
    Persist your current DSPy LM and settings to disk so a pipeline can be restored without reconfiguring.
    python
    import dspy
    dspy.settings.save('dspy_settings.json')
    # later, in another process:
    dspy.settings.load('dspy_settings.json')
    • Adds dspy.RLM module for reinforcement learning-style module execution, backed by an improved PythonInterpreter.
    • Adds save and load methods to DSPy settings, enabling persistence and restore of global configuration.
    • Adds tool description optimization for multi-agent systems in dspy.gepa, allowing GEPA to tune tool descriptions alongside prompts.
    • Enhances StreamListener to support generic type annotations for output, enabling typed streaming results.
    • Uses language field in system instructions for dspy.Code fields to guide code-generation formatting.
    └──▷ BREAKING ON UPGRADE
    • !FinalAnswerResult is renamed to FinalOutput in dspy.RLM, and the RLM.__call__ method is removed — code calling RLM as a callable or referencing FinalAnswerResult will break.
  7. 3.1.0 Jan 6, 2026 · issue -223

    DSPy 3.1.0 adds dspy.Reasoning, a File type, disable-fallback for ChatAdapter, and PKL-load guards.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.1.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.1.0
    └──▷ USE IT
    Capture native reasoning traces from a reasoning model (e.g. o3) alongside the final answer.
    python
    import dspy
    
    lm = dspy.LM('openai/o3')
    dspy.configure(lm=lm)
    
    class QA(dspy.Signature):
        question: str = dspy.InputField()
        reasoning: dspy.Reasoning = dspy.OutputField()
        answer: str = dspy.OutputField()
    
    predict = dspy.Predict(QA)
    result = predict(question='What is the capital of France?')
    print(result.reasoning)
    print(result.answer)
    • Adds dspy.Reasoning type to capture native chain-of-thought reasoning output directly from reasoning models.
    • Adds File type (dspy.File) for passing file data through DSPy signatures and pipelines.
    • Adds a disable-fallback option in ChatAdapter to prevent silent adapter fallback during inference.
    • Adds guards against loading .pkl files by default, and a parameter to load_memory_cache to block PKL files unless explicitly opted in.
    • Adds a method to extract the system message based on a given adapter and signature.
    +2 moreshow less
    • Extends the stream listener to work on any output type, not only strings.
    • Adds official support for Python 3.14.
  8. 3.0.4 Nov 10, 2025 · issue -280

    DSPy 3.0.4 adds Anthropic Citations, ToolCall.execute, MLflow/GEPA integration, custom GEPA component selection, and Arbor GRPO support.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.4 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.4
    └──▷ USE IT
    Execute a tool call returned by the model directly, rather than dispatching it manually.
    python
    result = tool_call.execute()
    • Adds gepa_kwargs parameter to pass custom keyword arguments to gepa.optimize, enabling per-run optimizer configuration.
    • Adds ToolCall.execute method for smoother programmatic tool execution in agentic pipelines.
    • Adds save and load methods to Embeddings for persisting embedding state.
    • Exposes dspy.evaluate.EvaluationResult as a first-class public symbol.
    • Adds Anthropic Citation API support, with a new dspy.Document primitive and citation-aware response handling.
    +10 moreshow less
    • Adds custom instruction_proposer support to GEPA, including multimodal dspy.Image handling.
    • Adds custom component selection logic to GEPA via a new selection callback.
    • Adds MLflow integration with GEPA for experiment tracking during optimization.
    • Adds Arbor GRPO sync update and an updated Arbor interface for reinforcement-learning-based optimization.
    • Allows custom types to be streamed and consumed via native response fields.
    • Adds a DSPy User-Agent header to outgoing LM requests, with support for overriding headers when specified.
    • Adds automatic llms.txt generation for documentation via the mkdocs-llmstxt plugin.
    • Supports CSV output (PR #8725), expanding the formats available for evaluation results.
    • Caches Image.format for improved throughput when working with dspy.Image inputs.
    • Deprecates Image.from_* helper methods in favor of a flexible unified Image constructor.
  9. 3.0.3 Aug 31, 2025 · issue -350

    DSPy 3.0.3 adds rollout_id for namespaced LM cache bypassing and automatic temperature scaling across multiple rollouts.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.3 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.3
    • Adds rollout_id parameter to bypass the LM cache in a namespaced way, allowing distinct rollout sessions to avoid cache collisions.
    • Automatically raises temperature when executing multiple rollouts, and warns when temperature would otherwise remain flat across them.
  10. 3.0.2 Aug 22, 2025 · issue -359

    DSPy 3.0.2 adds OpenAI Responses API support and custom stream chunk types in LM calls.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.2 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.2
    • Supports the OpenAI Responses API inside the LM class, enabling use of that endpoint alongside existing chat/completion modes.
    • Allows custom chunk types in streaming via dspy.LM stream handling, giving callers control over how streamed output is parsed.
    • Recognizes gpt-5-nano as a reasoning model, applying appropriate inference behavior automatically.
  11. 3.0.0 Aug 12, 2025 · issue -363

    DSPy 3.0 adds GEPA/SIMBA/GRPO optimizers, new adapters, multimodal types, async/streaming, and native MLflow 3.0 observability.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.0
    └──▷ USE IT
    Optimize a DSPy program's prompts with GEPA to get a Pareto-optimal, shorter prompt that outperforms MIPROv2 on your task.
    python
    import dspy
    from dspy import GEPA
    
    lm = dspy.LM('openai/gpt-4o')
    dspy.configure(lm=lm)
    
    optimizer = GEPA(metric=my_metric)
    optimized_program = optimizer.compile(my_program, trainset=trainset)
    Run a DSPy program with multimodal input, passing an image alongside text for vision-capable LLMs.
    python
    import dspy
    
    class DescribeImage(dspy.Signature):
        image: dspy.Image = dspy.InputField()
        question: str = dspy.InputField()
        answer: str = dspy.OutputField()
    
    lm = dspy.LM('openai/gpt-4o')
    dspy.configure(lm=lm)
    
    module = dspy.Predict(DescribeImage)
    result = module(image=dspy.Image.from_url('https://example.com/diagram.png'), question='What does this diagram show?')
    print(result.answer)
    • Adds dspy.GEPA (Genetic-Pareto) optimizer that builds a Pareto tree of prompts, uses NL reflection to extract and validate lessons, and can produce shorter prompts while improving downstream performance.
    • Adds dspy.GRPO reinforcement-learning optimizer for compound AI systems via the new Arbor library.
    • Adds dspy.SIMBA prompt optimizer that learns from custom feedback, suited for agentic and long-horizon tasks.
    • Adds dspy.BAMLAdapter alongside built-in dspy.ChatAdapter, dspy.JSONAdapter, and dspy.XMLAdapter, with token/status streaming, async paths, and intelligent fallback to native LLM structured outputs.
    • Adds dspy.Type base class enabling custom types to work automatically with all adapters.
    +14 moreshow less
    • Adds multimodal I/O via dspy.Image and dspy.Audio types, including composite types such as list[dspy.Image] and Pydantic models.
    • Adds dspy.History and dspy.ToolCalls higher-level I/O types.
    • Adds dspy.CodeAct and dspy.Refine modules, and a more reliable PythonInterpreter.
    • Adds dspy.syncify utility for running optimizers on async DSPy programs.
    • Adds dspy.Code type (landed in b3).
    • Adds Module.batch with thread-safe DSPy settings for high-concurrency workloads.
    • Adds native async support across modules and adapters (Chat and JSON adapters fully async).
    • Adds intermediate status streaming and output streaming from any layer, plus per-module history and usage tracking via rich callbacks.
    • Adds stable save/load for full programs, including the prompt management layer exportable via Adapters.
    • Adds native observability with MLflow 3.0, covering tracing, optimizer tracking, and improved deployment flows.
    • Adds out-of-the-box support for MCP servers and LangChain tools as tooling integrations.
    • Upgrades MIPROv2 with automatic hyperparameter selection for more reliable optimization.
    • Supports PEP 604 union types (e.g., int | str) in DSPy signatures.
    • Adds Windows support for MIPROv2 confirmation prompts.
    └──▷ BREAKING ON UPGRADE
    • !Community retrievers removed (#8073): unmaintained retriever integrations no longer ship; migrate to custom code or Tool/MCP integrations.
    • !Python 3.9 support dropped; supported versions are 3.10–3.13.
    • !The dspy.Program alias is removed; replace all uses with the concrete class.
    • !Legacy functional/ and dsp/ clients, old caches, examples, and tests removed (deprecations promised in 2.5 applied during 2.6 release candidates).
    • !BaseType renamed to Type (dspy.Type); any code referencing BaseType will break.
  12. 3.0.0b3 Jul 19, 2025 · issue -364

    DSPy 3.0.0b3 adds dspy.Code, dspy.syncify, and token streaming for XMLAdapter

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.0b3 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.0b3
    └──▷ USE IT
    Use dspy.Code as a typed output field in a signature to elicit structured code responses from the LM.
    python
    import dspy
    
    class GenerateCode(dspy.Signature):
        task: str = dspy.InputField()
        solution: dspy.Code = dspy.OutputField()
    
    predictor = dspy.Predict(GenerateCode)
    result = predictor(task='Write a Python function to reverse a string')
    print(result.solution)
    • Adds dspy.Code type for use in signatures, with an optional language parameter to specify the programming language of the expected code output.
    • Adds dspy.syncify to wrap async DSPy programs so they can be run through optimizers in synchronous contexts.
    • Adds token streaming support for XMLAdapter.
    • Renames dspy.BaseType to dspy.Type as the base class for custom structured types.
    └──▷ BREAKING ON UPGRADE
    • !dspy.BaseType is renamed to dspy.Type; code referencing dspy.BaseType will break after upgrading.
  13. 3.0.0b2 Jul 1, 2025 · issue -364

    DSPy 3.0.0b2 adds reusable stream listeners, PEP 604 union types in signatures, Gemini provider support, and format control for ToolCalls.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.0b2 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.0b2
    └──▷ USE IT
    Use modern Python union type syntax in an inline DSPy signature instead of typing.Union.
    python
    import dspy
    
    class Classify(dspy.Signature):
        text: str = dspy.InputField()
        label: int | str = dspy.OutputField()
    
    predictor = dspy.Predict(Classify)
    result = predictor(text='The sky is blue')
    Connect to Gemini as the active language model provider.
    python
    import dspy
    
    lm = dspy.LM('gemini/gemini-1.5-pro')
    dspy.configure(lm=lm)
    • Adds format parameter to ToolCalls for controlling tool call output format.
    • Supports PEP 604 union types (e.g. int | str) in inline signatures, enabling modern Python type hint syntax in dspy.Signature definitions.
    • Adds Gemini as a supported LM provider.
    • Changes default model for the Databricks provider to llama-4.
    • Allows reusing the StreamListener across multiple streaming calls.
    +3 moreshow less
    • Changes the output interface of evaluate — the return value of dspy.Evaluate has changed.
    • Removes pandas and datasets from core dependencies, making the base install lighter.
    • Drops Python 3.9 support; minimum supported version is now Python 3.10.
    └──▷ BREAKING ON UPGRADE
    • !The dspy.Program alias is removed; use dspy.Module directly.
    • !Python 3.9 is no longer supported; upgrade to Python 3.10 or higher.
    • !pandas and datasets are no longer installed as core dependencies; code that relied on them being available transitively will break.
    • !The output interface of evaluate (the dspy.Evaluate return value) has changed.
    • !The Hyperparameter class is removed.
    • !The experimental module is removed.
    • !dspy.settings entries related to dspy.Assertion are removed.
    • !The aws extra dependency group is removed; AWS-related dependencies must now be installed separately.
  14. 3.0.0b1 Jun 11, 2025 · issue -365

    DSPy 3.0.0b1 adds a global max_errors setting, an XML adapter, expanded PythonInterpreter permissions, and async-to-sync tool conversion.

    └──▷ GET THIS VERSION
    $ git clone --branch 3.0.0b1 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 3.0.0b1
    └──▷ USE IT
    Cap how many LM call errors a DSPy program tolerates before aborting, useful for guarding expensive optimization runs.
    python
    import dspy
    
    dspy.settings.configure(max_errors=5)
    
    # Now any program or optimizer that triggers more than 5 errors will stop early.
    • Adds global max_errors setting (via dspy.settings) to cap the number of errors tolerated across a DSPy program run.
    • Adds xml adapter as a new prompt/response adapter alongside the existing JSON adapter.
    • Expands permission capabilities in PythonInterpreter to support broader sandboxed code execution scenarios.
    • Supports automatic async-to-sync conversion for tools used in dspy.ReAct and similar modules, enabling async tool functions to be called in synchronous contexts.
    • Merges async settings changes into main, broadening asynchronous execution configuration.
    └──▷ BREAKING ON UPGRADE
    • !Community retriever integrations have been removed (PR #8073); programs using unmaintained retriever integrations must migrate to custom retriever code.
  15. 2.6.26 Jun 3, 2025 · issue -365

    DSPy 2.6.26 adds dspy.Tool as an input field type and dspy.ToolCall as an output field type.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.26 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.26
    └──▷ USE IT
    Define a typed DSPy signature where a module receives a tool and emits a structured tool call — useful for building agent steps that invoke tools in a verifiable, type-safe way.
    python
    import dspy
    
    class InvokeTool(dspy.Signature):
        tool: dspy.Tool = dspy.InputField()
        question: str = dspy.InputField()
        tool_call: dspy.ToolCall = dspy.OutputField()
    
    predictor = dspy.Predict(InvokeTool)
    • Supports dspy.Tool as an input field type and dspy.ToolCall as an output field type, enabling typed tool-calling signatures in DSPy programs.
  16. 2.6.25 Jun 2, 2025 · issue -365

    DSPy 2.6.25 adds CodeAct module, dspy.Audio type, LangChain tool support, and per-module LM history tracking.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.25 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.25
    └──▷ USE IT
    Pass audio data as a typed Signature field to a DSPy module for multimodal LM tasks.
    python
    import dspy
    
    class TranscribeAudio(dspy.Signature):
        audio: dspy.Audio = dspy.InputField()
        transcript: str = dspy.OutputField()
    
    predictor = dspy.Predict(TranscribeAudio)
    result = predictor(audio=dspy.Audio.from_url("https://example.com/sample.wav"))
    print(result.transcript)
    Inspect per-module LM history to debug or audit exactly which calls a specific module made.
    python
    import dspy
    
    lm = dspy.LM("openai/gpt-4o")
    dspy.configure(lm=lm)
    
    classify = dspy.Predict("text -> label")
    classify(text="Suspicious login from unknown IP")
    
    # Inspect history scoped to this module only
    print(classify.history)
    • Adds dspy.Audio as a new built-in field type for passing audio inputs through Signatures.
    • Adds CodeAct module (dspy.CodeAct) enabling code-execution-based agentic reasoning loops.
    • Adds LangChain tool support, allowing LangChain tools to be used directly within DSPy modules.
    • Adds per-module LM history, enabling each module instance to track its own LM call history independently.
    • Adds a standard base class for creating custom Signature field types, enabling user-defined typed fields in Signatures.
    +6 moreshow less
    • Adds custom type resolution in Signatures for more flexible type handling in custom field definitions.
    • Supports Service Principal Auth for Databricks Retrieve, enabling non-interactive credential flows.
    • Supports custom imported module serialization via cloudpickle for more robust program save/load workflows.
    • Extends dspy.Image to accept gs:// URLs from Google Cloud Platform.
    • Supports Python 3.13.
    • Streaming support extended to models that do not split stream chunks at token boundaries.
  17. 2.6.24 May 17, 2025 · issue -366

    DSPy 2.6.24 adds the GRPO optimizer and a new AdapterParseError exception class.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.24 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.24
    └──▷ USE IT
    Catch adapter parse failures separately from other errors when running a DSPy module.
    python
    import dspy
    
    try:
        result = my_module(question="What is the capital of France?")
    except dspy.AdapterParseError as e:
        print(f"Adapter failed to parse LM output: {e}")
    • Adds AdapterParseError exception class to dspy for catching adapter parsing failures programmatically.
    • Adds GRPO optimizer to DSPy for reinforcement-learning-style prompt/weight optimization.
    • Improves sync streaming ergonomics, making it easier to consume streamed LM responses without async.
    • Adds better defaults and warnings around LM max_tokens to surface misconfiguration earlier.
  18. 2.6.23 May 5, 2025 · issue -366

    DSPy 2.6.23 adds async streaming support and token streaming with the JSON adapter.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.23 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.23
    • Supports streaming in async DSPy programs, enabling real-time token delivery in async execution contexts.
    • Supports token streaming with the JSON adapter, so structured-output pipelines can now stream tokens incrementally.
    • Adds a utility to convert an async stream to a sync stream, bridging async streaming sources into synchronous DSPy programs.
    • Updates MIPROv2 auto settings and general optimizer behavior.
  19. 2.6.22 Apr 30, 2025 · issue -367

    DSPy 2.6.22 adds async support to ReAct and caching for async LM calls, plus custom types in MCP tools.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.22 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.22
    • Adds async execution path to dspy.ReAct, enabling non-blocking agent loops in async applications.
    • Adds caching support for async LM calls, bringing async usage to parity with the synchronous cache behavior.
    • Supports arguments of custom types in dspy MCP tool definitions, expanding the range of tool signatures that can be expressed.
    • Improves adapter handling of Python Literal and Optional types for more robust input/output validation.
  20. 2.6.20 Apr 28, 2025 · issue -367

    DSPy 2.6.20 adds native async support for callbacks and dspy.Tool, plus MCP tool integration via dspy.Tool.from_mcp_tool.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.20 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.20
    └──▷ USE IT
    Wrap an MCP tool as a DSPy tool to use it inside a ReAct agent on the same day MCP tools are available.
    python
    import dspy
    
    # mcp_tool is an MCP-protocol tool object from your MCP session
    dspy_tool = dspy.Tool.from_mcp_tool(mcp_tool)
    
    agent = dspy.ReAct(signature="question -> answer", tools=[dspy_tool])
    result = agent(question="What is the current price of AAPL?")
    • Adds dspy.Tool.from_mcp_tool class method to construct a dspy.Tool directly from an MCP tool, enabling Model Context Protocol integration.
    • Adds native async support for callbacks and dspy.Tool, allowing asynchronous execution throughout the DSPy module pipeline.
  21. 2.6.19 Apr 24, 2025 · issue -367

    DSPy 2.6.19 adds async support on critical paths, a fanout cache, and expanded dspy.Tool argument handling.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.19 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.19
    └──▷ USE IT
    Pass kwargs-accepting functions directly as ReAct tools when the tool signature is dynamic or variadic.
    python
    import dspy
    
    def search(query: str, **kwargs) -> str:
        # kwargs can carry optional parameters like top_k, filters, etc.
        return f"Results for {query}"
    
    tool = dspy.Tool(search)
    react = dspy.ReAct("Answer the question.", tools=[tool])
    result = react(question="What is the capital of France?")
    Run multiple DSPy module calls concurrently in an async application to parallelize LM requests.
    python
    import asyncio
    import dspy
    
    dspy.configure(lm=dspy.LM("openai/gpt-4o"))
    qa = dspy.ChainOfThought("question -> answer")
    
    async def main():
        results = await asyncio.gather(
            qa.acall(question="What is SSRF?"),
            qa.acall(question="What is SSTI?"),
        )
        print(results)
    
    asyncio.run(main())
    • Supports composite argument type parsing in dspy.Tool, enabling richer type hints for tool inputs.
    • Supports kwargs in dspy.Tool, allowing tools to accept variable keyword arguments.
    • Allows overwriting max_iter at runtime in ReAct, giving per-invocation control over agent loop depth.
    • Adds async support across DSPy critical paths, enabling non-blocking LM calls in async workflows.
    • Introduces a fanout cache for DSPy, enabling parallel cache lookups to reduce latency.
  22. 2.6.18 Apr 18, 2025 · issue -367

    DSPy 2.6.18 adds global num_threads/provide_traceback settings, a two-step adapter, streaming support, and default args in dspy.Tool.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.18 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.18
    └──▷ USE IT
    Set thread concurrency and traceback behavior once at startup rather than on every call.
    python
    import dspy
    
    dspy.settings.configure(
        num_threads=16,
        provide_traceback=True,
    )
    
    lm = dspy.LM('openai/gpt-4o')
    dspy.settings.configure(lm=lm)
    Wrap a function that has optional parameters as a dspy.Tool without manually supplying defaults on every invocation.
    python
    import dspy
    
    def search(query: str, top_k: int = 5) -> list:
        ...
    
    tool = dspy.Tool(search)  # default top_k=5 is preserved automatically
    • Moves num_threads into dspy.settings so thread concurrency can be configured globally instead of per-call.
    • Moves provide_traceback into dspy.settings for global traceback control across all modules.
    • Adds a maximum size cap for the global history to bound memory growth during long runs.
    • Introduces a two-step adapter for improved structured-output handling.
    • Supports default argument values in dspy.Tool, reducing boilerplate when wrapping functions with optional parameters.
    +1 moreshow less
    • Adds generic streaming support across optimizers and modules.
  23. 2.6.16 Mar 28, 2025 · issue -368

    DSPy 2.6.16 adds usage tracking and SIMBA trial logs.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.16 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.16
    • Adds trial logs to the SIMBA optimizer, surfacing per-trial diagnostic information during optimization runs.
    • Adds usage tracking to monitor LLM call statistics across DSPy programs.
  24. 2.6.15 Mar 24, 2025 · issue -368

    DSPy 2.6.15 ships the experimental SIMBA optimizer, more customizable ChainOfThought, and multi-output ProgramOfThought.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.15 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.15
    • Adds experimental dspy.SIMBA optimizer with an accompanying Tool-Use Tutorial.
    • Allows dspy.ChainOfThought to be more customizable.
    • Allows dspy.ProgramOfThought to accept multiple output fields.
  25. 2.6.14 Mar 21, 2025 · issue -368

    DSPy 2.6.14 adds context-manager protocol support to PythonInterpreter and a new construct_result_table method on Evaluate.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.14 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.14
    └──▷ USE IT
    Use PythonInterpreter as a context manager to ensure proper cleanup after sandboxed code execution.
    python
    from dspy.predict.python_interpreter import PythonInterpreter
    
    with PythonInterpreter() as interpreter:
        result = interpreter("output = 2 + 2")
        print(result)
    • Adds context-manager protocol (with statement) support to PythonInterpreter, enabling cleaner resource management when executing sandboxed Python code.
    • Introduces construct_result_table method on the Evaluate class, exposing structured result tables from evaluation runs.
  26. 2.6.13 Mar 19, 2025 · issue -368

    DSPy 2.6.13 adds image support to JSONAdapter, Pydantic field constraints in adapters, and extensible BaseLM.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.13 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.13
    └──▷ USE IT
    Send an image input through the JSON adapter for multimodal LM tasks.
    python
    import dspy
    
    lm = dspy.LM('openai/gpt-4o')
    dspy.configure(lm=lm, adapter=dspy.JSONAdapter())
    
    class DescribeImage(dspy.Signature):
        image: dspy.Image = dspy.InputField()
        description: str = dspy.OutputField()
    
    predictor = dspy.Predict(DescribeImage)
    result = predictor(image=dspy.Image.from_url('https://example.com/chart.png'))
    print(result.description)
    • Adds image support to dspy.JSONAdapter, enabling multimodal inputs through the JSON adapter alongside the existing chat adapter.
    • Supports Pydantic field constraints in DSPy adapters, allowing typed output fields to carry validation rules (e.g. min/max length, numeric bounds).
    • Makes dspy.BaseLM extensible, allowing custom LM subclasses to override and extend base behavior.
    • Adds compile and get_params methods to the Teleprompter base class, standardizing the optimizer interface.
    • Allows dspy.ChatAdapter parser to accept field headers and content on the same line, broadening the range of parseable model outputs.
    +1 moreshow less
    • Improves dspy.BestOfN with enhanced error handling.
  27. 2.6.12 Mar 13, 2025 · issue -368

    DSPy 2.6.12 adds callback_metadata to evaluate and simplifies dspy.LM

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.12 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.12
    • Adds callback_metadata parameter to the evaluate function, enabling richer context to be passed through evaluation callbacks.
    • Simplifies the dspy.LM interface.
  28. 2.6.11 Mar 10, 2025 · issue -368

    DSPy 2.6.11 adds Python 3.13 support and timeout-based straggler resubmission in ParallelExecutor.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.11 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.11
    • Adds timeout-based straggler resubmission in ParallelExecutor, preventing slow tasks from blocking parallel evaluation runs.
    • Supports Python 3.13, unblocking use of DSPy on the latest Python release.
    • Reduces memory usage at import dspy startup.
  29. 2.6.10 Mar 4, 2025 · issue -368

    DSPy 2.6.10 adds support for non-image MIME types in image_url content fields.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.10 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.10
    • Supports non-image MIME types in image_url content, enabling multimodal inputs beyond images.
  30. 2.6.9 Mar 3, 2025 · issue -368

    DSPy 2.6.9 adds multi-turn history support, an evaluate callback, and a provide_traceback option for MIPRO.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.9 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.9
    • Allows passing provide_traceback to MIPRO optimizer runs to surface full tracebacks during optimization.
    • Adds evaluate callback support, enabling hooks into the evaluation lifecycle.
    • Supports multi-turn conversation history in DSPy modules.
  31. 2.6.6 Feb 24, 2025 · issue -369

    DSPy 2.6.6 adds dspy.Refine and dspy.BestOfN modules for iterative and best-of-N generation strategies.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.6 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.6
    • Adds dspy.Refine module for iterative refinement of generated outputs.
    • Adds dspy.BestOfN module for sampling multiple candidate outputs and selecting the best one.
  32. 2.6.5 Feb 20, 2025 · issue -369

    DSPy 2.6.5 adds multitenancy support for Weaviate vector store integration.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.5 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.5
    • Adds multitenancy support to the Weaviate integration, enabling tenant-isolated retrieval in multi-tenant Weaviate deployments.
  33. 2.6.3 Feb 16, 2025 · issue -369

    DSPy 2.6.3 adds status streaming support and context truncation for ReAct agents

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.3 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.3
    • Supports status streaming via dspy.streamify, now using context instead of settings for improved isolation.
    • Adds context truncation logic for ReAct to prevent runaway context growth in long agentic loops.
    • Improves dspy.Tool with enhancements to tool invocation behavior.
  34. 2.6.2 Feb 3, 2025 · issue -369

    DSPy 2.6.2 adds the InferRules optimizer and multimodal example support with dspy.Image.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.2 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.2
    • Adds InferRules optimizer for automated rule inference during prompt optimization.
    • Supports arbitrary dspy.Image objects inside DSPy examples, enabling multimodal training and optimization workflows.
  35. 2.6.1 Feb 3, 2025 · issue -369

    DSPy 2.6.1 adds o3-mini support, separates in-memory cache from LiteLLM, and lets production deployments skip history writes.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.1 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.1
    └──▷ TRY IT
    Disable all DSPy caching in a production environment where you want no disk or memory cache overhead.
    $ DSP_CACHEBOOL=false python my_dspy_app.py
    Use o3-mini as your language model for a DSPy program.
    python
    import dspy
    lm = dspy.LM('openai/o3-mini')
    dspy.configure(lm=lm)
    • Adds DSP_CACHEBOOL environment variable support: setting it to false skips cache initialization entirely.
    • Separates DSPy's in-memory cache from the LiteLLM cache, giving independent control over each layer.
    • Adds a new option to disable DSPy's write-to-history behavior for production deployments where history tracking is unwanted.
    • Moves the default joblib cache directory into .dspy_cache for cleaner local storage layout.
    • Adds support for o3-mini and other OpenAI reasoning models in the lm module.
    +3 moreshow less
    • Enables Optuna to learn from full evaluations when running MIPROv2 in minibatch mode, improving optimizer sample efficiency.
    • Enforces 3 demos in MIPROv2 meta-prompt for more consistent optimizer behavior.
    • Supports lists of models in module parameters.
  36. 2.6.0 Jan 30, 2025 · issue -370

    DSPy 2.6.0 adds streaming support, sandboxed Python interpreter, LiteLLM retry policy, and BootstrapFT improvements.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.0
    • Adds streaming support via dspy (PR #1874), enabling real-time token-by-token output from LM calls.
    • Refactors the Python interpreter to run in a sandbox for safer code execution in agentic pipelines.
    • Supports LLM call retries via LiteLLM RetryPolicy integration.
    • Improves BootstrapFT optimizer relative to the 2.4 baseline.
    • Adds argument parsing support for dspy.ReAct.
    +2 moreshow less
    • Improves Literal type format adherence in ChatAdapter and JSONAdapter.
    • Refines thread-safety semantics for Settings.
    └──▷ BREAKING ON UPGRADE
    • !Removes deprecated functional/ module — code importing from it will break.
    • !Removes deprecated dsp/ clients — code importing from them will break.
    • !Removes old caches — any tooling relying on the previous cache layout will break.
  37. 2.6.0rc8 Jan 1, 2025 · issue -370

    DSPy 2.6.0rc8 adds AlfWorld dataset, sandboxed Python interpreter, and dspy.__version__ introspection.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.0rc8 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.0rc8
    └──▷ USE IT
    Check the installed DSPy version at runtime without parsing package metadata.
    python
    import dspy
    print(dspy.__version__)
    • Exposes dspy.__version__ for programmatic version introspection.
    • Refactors the Python interpreter tool to run in a sandbox for safer code execution.
    • Adds the AlfWorld dataset and an accompanying tutorial for interactive decision-making tasks.
    • Improves BootstrapFT optimizer behavior.
    • Allows DatabricksRM to return empty results when no documents are retrieved, instead of raising an error.
  38. 2.6.0rc6 Dec 22, 2024 · issue -371

    DSPy 2.6.0rc6 adds response_model key to LM history entries.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.0rc6 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.0rc6
    • Adds response_model key to LM history entries, exposing the structured output model used for each language model call.
  39. 2.6.0rc4 Dec 18, 2024 · issue -371

    DSPy 2.6.0rc4 adds streaming support for language model calls.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.0rc4 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.0rc4
    • Adds streaming support for language model outputs.
  40. 2.6.0rc3 Dec 17, 2024 · issue -371

    DSPy 2.6.0rc3 adds LiteLLM RetryPolicy support and thread-safe Settings semantics.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.6.0rc3 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.6.0rc3
    • Supports automatic retries for LM calls via LiteLLM RetryPolicy integration.
    • Refines thread-safety semantics for Settings to make concurrent DSPy usage more reliable.
  41. 2.5.43 Dec 13, 2024 · issue -371

    DSPy 2.5.43 adds logprob support in Predictor and a new docs_uri_column_name field for DatabricksRM.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.43 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.43
    └──▷ USE IT
    Retrieve documents from Databricks Vector Search and map a custom URI column to results.
    python
    retriever = DatabricksRM(
        databricks_index_name='my_index',
        docs_uri_column_name='source_url',
        text_column_name='content',
        k=5
    )
    • Adds docs_uri_column_name parameter to DatabricksRM to specify which column holds document URIs when retrieving results.
    • Enables returning log probabilities from Predictor, exposing token-level confidence scores for model outputs.
    • Improves DSPy module saving fidelity.
  42. 2.5.42 Dec 10, 2024 · issue -371

    DSPy 2.5.42 adds tool callbacks, in-memory LM caching, structured output support, and broader type coverage.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.42 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.42
    • Adds on_tool_start and on_tool_end callbacks for observability hooks around tool execution.
    • Integrates cachetools for in-memory LM caching, with support for unhashable types and Pydantic models.
    • Supports structured outputs response format derived from the signature in the JSON adapter.
    • Expands supported types for DSPy signatures via broader type annotation handling.
    • Makes DatabricksRM compatible with the Mosaic agent framework.
  43. 2.5.41 Nov 29, 2024 · issue -372

    DSPy 2.5.41 adds Signature docstring context to ReAct and a new MATH reasoning dataset with metric and tutorial.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.41 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.41
    • Includes the Signature __doc__ string in the system message for the ReAct module, giving the LLM richer task context from inline documentation.
    • Adds a MATH reasoning dataset, accompanying metric, and tutorial for benchmarking and optimizing mathematical reasoning programs.
  44. 2.5.40 Nov 26, 2024 · issue -372

    DSPy 2.5.40 lets ReAct tools wrap class methods and serializes datetimes/enums via pydantic adapters.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.40 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.40
    └──▷ USE IT
    Register a class method as a ReAct tool so stateful or object-oriented tooling can be used directly in a ReAct pipeline.
    python
    import dspy
    
    class MySearch:
        def __init__(self, index):
            self.index = index
    
        def search(self, query: str) -> str:
            """Search the index for a query."""
            return self.index.get(query, 'not found')
    
    searcher = MySearch(index={'dspy': 'A framework for programming LMs'})
    tool = dspy.react.Tool(searcher.search)
    
    react = dspy.ReAct('question -> answer', tools=[tool])
    print(react(question='What is dspy?'))
    • Allows react.Tool to wrap class methods (not just standalone functions), expanding the surfaces that can be registered as ReAct tools.
    • Adapters now support JSON serialization of arbitrary pydantic-compatible types — including datetimes, enums, and other complex types — via pydantic's serialization layer.
    • Switches DSPy settings storage from a contextvar to thread-local storage, improving compatibility with Colab and multi-threaded environments.
  45. 2.5.36 Nov 24, 2024 · issue -372

    DSPy 2.5.36 converts settings to a ContextVar and allows user-launched threads to inherit DSPy context safely.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.36 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.36
    • Converts dspy.settings to a ContextVar, enabling per-thread/per-context isolation of DSPy configuration.
    • Extends ParallelExecutor to isolate context even when running with a single thread.
    • Permits user-launched threads to carry DSPy settings context, enabling safe concurrent use outside of DSPy-managed execution.
  46. 2.5.35 Nov 24, 2024 · issue -372

    DSPy 2.5.35 raises the default cache limit to 30 GB.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.35 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.35
    • Expands the default cache limit from its previous size to 30 GB, enabling larger-scale LM call caching without manual configuration.
  47. 2.5.34 Nov 22, 2024 · issue -372

    DSPy 2.5.34 adds a thread-safe faiss kNN retriever, a grounded completeness metric, and an Unbatchify utility.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.34 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.34
    • Adds dspy.retrievers.Embeddings — a thread-safe, memory-friendly faiss k-nearest-neighbour retrieval index.
    • Introduces CompleteAndGrounded metric for evaluating whether generated outputs are both complete and grounded in source context.
    • Introduces Unbatchify utility for converting batched outputs back into individual items.
  48. 2.5.33 Nov 22, 2024 · issue -372

    DSPy 2.5.33 adds a teacher module to MIPROv2 and improves its logging.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.33 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.33
    • Adds a teacher module to MIPROv2, enabling separate teacher-student optimization configurations.
    • Improves MIPROv2 logging output for better visibility into optimization runs.
  49. 2.5.30 Nov 16, 2024 · issue -372

    DSPy 2.5.30 adds dspy.asyncify for async module wrapping and native parallel execution support.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.30 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.30
    └──▷ USE IT
    Wrap a synchronous DSPy module to run asynchronously in an async context, avoiding blocking the event loop.
    python
    import dspy
    
    predict = dspy.Predict('question -> answer')
    async_predict = dspy.asyncify(predict)
    
    result = await async_predict(question='What is the capital of France?')
    • Adds dspy.asyncify to wrap synchronous DSPy modules for asynchronous execution.
    • Adds native parallel execution support via ParallelExecutor for running DSPy programs concurrently.
  50. 2.5.29 Nov 8, 2024 · issue -372

    DSPy 2.5.29 adds a Databricks finetuning integration.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.29 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.29
    • Adds Databricks finetuning integration, enabling DSPy programs to leverage Databricks-hosted model finetuning workflows.
  51. 2.5.28 Nov 7, 2024 · issue -372

    DSPy 2.5.28 revamps BootstrapFinetune, merges BetterTogether optimizer, and adds a flag to suppress LiteLLM logs in dspy.LM.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.28 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.28
    • Adds a flag to dspy.LM to suppress LiteLLM log output, reducing noise when running DSPy programs.
    • Revamps BootstrapFinetune and promotes the BetterTogether optimizer from experimental to main, making combined few-shot and fine-tuning optimization available in the standard release.
  52. 2.5.26 Nov 6, 2024 · issue -372

    DSPy 2.5.26 adds exponential backoff retries for LM calls and drops the structlog dependency.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.26 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.26
    • Removes the structlog dependency, reducing the library's install footprint.
    • Adds automatic retry with exponential backoff for LM calls on a limited set of error codes.
  53. 2.5.23 Nov 3, 2024 · issue -372

    DSPy 2.5.23 adds image support and chainable loading for Predict modules.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.23 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.23
    • Adds chainable loading for Predict modules, enabling fluent module initialization patterns.
    • Adds image support to DSPy programs.
  54. 2.5.21 Oct 30, 2024 · issue -373

    DSPy 2.5.21 adds automatic retries to LM calls via LiteLLM and enables ReAct to handle functions without docstrings.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.21 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.21
    • Adds automatic retry support to LM calls made through LiteLLM, improving resilience against transient API failures.
    • Enables ReAct to handle tool functions that have no docstring, removing a previous hard requirement on function documentation.
    └──▷ BREAKING ON UPGRADE
    • !The retry_strategy parameter has been removed from LM; existing code that sets retry_strategy will break on upgrade.
  55. 2.5.17 Oct 26, 2024 · issue -373

    DSPy 2.5.17 introduces JsonAdapter with automatic retries and a new callback mechanism for LM pipeline observability.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.17 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.17
    • Adds JsonAdapter as a new adapter alongside the improved ChatAdapter, with default retries built in for more resilient LM calls.
    • Adds a callback mechanism enabling hooks into DSPy module execution for observability and instrumentation.
    └──▷ BREAKING ON UPGRADE
    • !dspy.TypedPredictor and its variants are deprecated — callers should migrate to dspy.Predict, dspy.ChainOfThought, or other standard predictors.
  56. 2.5.11 Oct 16, 2024 · issue -373

    DSPy 2.5.11 adds SemanticF1 metric for evaluating semantic similarity of generated answers.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.11 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.11
    • Adds SemanticF1 metric for evaluating semantic similarity between predicted and expected answers.
  57. 2.5.10 Oct 16, 2024 · issue -373

    DSPy 2.5.10 adds Text Embeddings Inference (TEI) support.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.10 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.10
    • Adds support for Text Embeddings Inference (TEI) as an embedding backend.
  58. 2.5.9 Oct 15, 2024 · issue -373

    DSPy 2.5.9 adds reasoning/rationale support to MultiChainComparison.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.9 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.9
    • Adds reasoning/rationale support to MultiChainComparison, enabling the module to incorporate chain-of-thought rationale when comparing multiple completions.
  59. 2.5.4 Oct 8, 2024 · issue -373

    DSPy 2.5.4 adds num_retries to typed signature optimization and filterable LM history content.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.4 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.4
    • Adds num_retries parameter to signature_opt_typed to control retry behavior in typed signature optimization.
    • Enhances LM history with filterable content, enabling more targeted inspection of past interactions.
    • Formats Pydantic fields as JSON in chat_adapter, improving structured output handling for chat-based LMs.
  60. 2.5.1 Sep 28, 2024 · issue -374

    DSPy 2.5.1 publishes to the dspy PyPI package name alongside dspy-ai.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.1 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.1
    • Publishes the package to dspy on PyPI in addition to dspy-ai, so users can install with pip install dspy.
  61. 2.5.0 Sep 23, 2024 · issue -374

    DSPy 2.5.0 adds type casting and enforcement to adapters with a migration notebook.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.5.0 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.5.0
    • Adds type casting and enforcement to adapters, with an accompanying migration notebook to guide upgrades from older patterns.
  62. 2.4.16 Sep 13, 2024 · issue -374

    DSPy 2.4.16 introduces new dspy.LM and dspy.Adapter classes and adds support for o1 model parameters.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.4.16 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.4.16
    • Adds dspy.LM and dspy.Adapter classes, foundational new interfaces for language model and adapter management in DSPy 2.5 onwards (existing clients are unaffected).
    • Supports o1 model parameters in dspy LM configuration.
    • Enables LangChain objects to be copied within DSPy workflows.
  63. 2.4.13 Jul 29, 2024 · issue -376

    DSPy 2.4.13 adds configurable LM/RM backoff time and LangChain tool execution support.

    └──▷ GET THIS VERSION
    $ git clone --branch 2.4.13 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout 2.4.13
    └──▷ USE IT
    Slow down retry pressure on rate-limited LM providers by setting a custom backoff interval at startup.
    python
    dspy.settings.configure(backoff_time=5)
    • Adds backoff_time parameter to dspy.settings.configure() for configurable retry backoff across LM/RM providers.
    • Adds LangChain Tool Execution support.
  64. v2.4.12 Jul 8, 2024 · issue -376

    DSPy v2.4.12 lets you compile dspy.Predict and dspy.ChainOfThought directly and improves Chat LM adapter support.

    └──▷ GET THIS VERSION
    $ git clone --branch v2.4.12 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout v2.4.12
    • Supports compiling dspy.Predict and dspy.ChainOfThought directly as Modules without wrapping them in a dspy.Module object.
    • Improves the experimental=True Chat LM adapter support (enabled via dspy.configure(experimental=True)) introduced in v2.4.11, refining zero-shot generation quality for Chat LMs including GPT-3.5, GPT-4, Llama3, Mixtral, and DBRX.
  65. v2.4.11 Jul 6, 2024 · issue -376

    DSPy v2.4.11 adds experimental adapter support for smoother Chat LM zero-shot generation via dspy.configure(experimental=True)

    └──▷ GET THIS VERSION
    $ git clone --branch v2.4.11 https://github.com/stanfordnlp/dspy.git
    # already have the repo? check out this version:
    $ git checkout v2.4.11
    └──▷ USE IT
    Activate the new Chat LM adapters to get more predictable zero-shot outputs without changing your existing DSPy program logic.
    python
    import dspy
    dspy.configure(experimental=True)
    • Enables dspy.configure(experimental=True) to activate new adapter support, improving zero-shot generation predictability and accuracy for Chat LMs including GPT-3.5, GPT-4, Llama3, Mixtral, and DBRX.
    • Adds initial support for new adapters with improved handling of Chat LM interactions.
my-toolchain — 0 tools
paste an install list to detect your tools

A brew list, a Brewfile, requirements.txt, a Dockerfile — or just the product names, free-form. Nothing leaves your browser.

    browse all tools →