DSPy
3.3.1 open-sourceDSPy: The framework for programming—not prompting—language models
pip install "dspy[deno]"
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",
},
)
tool = dspy.Tool.from_mcp_tool(client, mcp_tool, result_mode="structured")
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")
import dspy
try:
result = lm(messages=[{"role": "user", "content": "Hello"}])
except dspy.LMError as e:
print(f"LM call failed: {e}")
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
pip install "dspy[numpy]"
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)
import dspy
dspy.configure_cache(restrict_pickle=True)
import dspy
dspy.configure(warn_on_type_mismatch=False)
import dspy
dspy.settings.save('dspy_settings.json')
# later, in another process:
dspy.settings.load('dspy_settings.json')
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)
result = tool_call.execute()
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)
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)
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)
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')
import dspy
lm = dspy.LM('gemini/gemini-1.5-pro')
dspy.configure(lm=lm)
import dspy
dspy.settings.configure(max_errors=5)
# Now any program or optimizer that triggers more than 5 errors will stop early.
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)
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)
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)
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}")
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?")
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?")
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())
import dspy
dspy.settings.configure(
num_threads=16,
provide_traceback=True,
)
lm = dspy.LM('openai/gpt-4o')
dspy.settings.configure(lm=lm)
import dspy
def search(query: str, top_k: int = 5) -> list:
...
tool = dspy.Tool(search) # default top_k=5 is preserved automatically
from dspy.predict.python_interpreter import PythonInterpreter
with PythonInterpreter() as interpreter:
result = interpreter("output = 2 + 2")
print(result)
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)
DSP_CACHEBOOL=false python my_dspy_app.py
import dspy
lm = dspy.LM('openai/o3-mini')
dspy.configure(lm=lm)
import dspy
print(dspy.__version__)
retriever = DatabricksRM(
databricks_index_name='my_index',
docs_uri_column_name='source_url',
text_column_name='content',
k=5
)
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?'))
import dspy
predict = dspy.Predict('question -> answer')
async_predict = dspy.asyncify(predict)
result = await async_predict(question='What is the capital of France?')
dspy.settings.configure(backoff_time=5)
import dspy
dspy.configure(experimental=True) 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
Examples
Command line
No option matches that search.
| option | found in | since | description |
|---|
No option matches that search.
Values are placeholders taken from each option’s declared default. Nothing is executed here — the output shown is a recording of a run that already happened.
Release history
- 3.3.1
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 ITInstall 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.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.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 forPythonInterpreter, pinning Pyodide and validating Deno>=2.0.0,<3.0.0without requiring a system install. - ›Adds
result_mode='structured'parameter to dspy.Tool.from_mcp_tool(), returningstructuredContentfrom MCP SDK v2 servers (including arrays, scalars, empty values, and explicit JSONnull) with fallback to existing content conversion. - ›Supports GEPA 0.1.4's multi-proposal contracts via
gepa_kwargs, accepting keyssampling_strategy,selection_strategy, andacceptance_criterionto enable concurrent candidate evaluation within the existingnum_threadsbudget. - ›Adds objective-aware frontier tracking in GEPA via
gepa_kwargs, supportingobjective_scoresdimensions (quality, privacy, cost) for parent/merge selection while the scalar metric continues to gate acceptance. - ›Exposes full
PythonInterpreterlifecycle 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_instructionsto 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
timeoutparameter to Image.from_url() and Audio.from_url(), defaulting to 30 seconds; passtimeout=Noneto 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.
- ›
CodeInterpreterErroris now also aDSPyErrorsubclass while retainingRuntimeErrorcompatibility, enabling unified catch blocks across interpreter and agent modules. - ›
max_reflection_costin DSPy's GEPA adapter now raises clearly when set instead of silently providing an ineffective budget. - ›Strengthens
PythonInterpretersandbox 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.CodeActanddspy.ProgramOfThoughtnow emitDeprecationWarningon construction and are scheduled for removal in DSPy 3.5; migrate todspy.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=Noneexplicitly.
- ›Adds
- 3.3.0
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 ITLet GEPA discover the full program structure — not just prompts — for a QA task, then inspect and save the generated implementation.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.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 singledspy.Predictbaseline, ordspy.RLMwhen tools are supplied. - ›Adds
max_predictor_callsguard on Flex-generated programs to prevent runaway LM usage in optimizer-authored code, and supports aprogram_traceargument to metrics so programs can be scored on how a result was produced (e.g. penalizing excessive LM calls). - ›Persists optimizer-discovered
module_srcas 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, usingdspy.History,dspy.Tool, anddspy.ToolCalls(which can optionally storedspy.ToolCallResults) instead of customnext_tool_args/trajectorysyntax. - ›Adds
parallel_tool_callssupport todspy.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 throughBaseLM.__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_choicerequest shapes, with legacy Responses outputs using the same Chat-style tool-call representation as the Chat Completions path. - ›Makes
numpyan 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
DspyGEPAResultto mirrorgepa[dspy]==0.1.1result shapes, makingcandidatesandbest_candidatereturn compiled DSPy modules;val_subscores,per_val_instance_best_candidates,best_outputs_valset, andhighest_score_achieved_per_val_taskall have updated types keyed by validation instance id. - ›Replaces
reflection_prompt_templateindspy.GEPAgepa_kwargswith aninstruction_proposerparameter for custom proposal behavior (passingreflection_prompt_templatenow raises a clearValueError).
└──▷ BREAKING ON UPGRADE- !Constructing
dspy.Image,dspy.Audio, ordspy.Filefrom 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/verifyoptions 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.
- !
numpyis no longer installed with basedspy; code using embeddings, KNN/KNNFewShot, SIMBA, or other NumPy-backed paths will break unlesspip install 'dspy[numpy]'is added. - !
DspyGEPAResult.candidatesnow returns a list of compiled DSPy modules instead of instruction dictionaries, andDspyGEPAResult.best_candidatenow returns a compiled DSPy module; code inspectingoptimized_program.detailed_resultsmust be updated. - !
DspyGEPAResultfieldsval_subscores,per_val_instance_best_candidates,best_outputs_valset, andhighest_score_achieved_per_val_taskhave 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_templatethroughgepa_kwargsindspy.GEPAnow raises aValueError; useinstruction_proposerinstead. - !
RLM.max_iterationsis renamed toRLM.max_iters; code constructing dspy.RLM(max_iterations=...) will break.
- ›Adds
- 3.3.0
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 ITLet GEPA discover the best program structure for a Q&A task instead of hand-designing decomposition.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 discoveredInstall 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 singledspy.Predict(ordspy.RLMwhen 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 inoptimized.module_srcand preserved through save/load. - ›Adds
max_predictor_callsguard todspy.Flex-generatedprograms to prevent runaway LM usage in optimizer-authored code, and allows metrics to accept aprogram_traceargument to score how a result was produced. - ›Adds
dspy.ReActV2, an experimental ReAct implementation built on native tool calling that usesdspy.History,dspy.Tool, anddspy.ToolCalls(optionally storingdspy.ToolCallResults) instead of the customnext_tool_args/ trajectory syntax. - ›Adds
parallel_tool_callssupport indspy.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.LMResponseand aBaseLM.forward(request: dspy.LMRequest) -> dspy.LMResponsecontract; 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_choicerequest shapes, and typedLMToolCallPartobjects preserve raw provider fields. - ›Makes
numpyan 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
DspyGEPAResultto mirror thegepa[dspy]==0.1.1API:candidatesandbest_candidateare now compiled DSPy modules,val_subscoresislist[dict[Any, float]]keyed by validation instance id, andbest_outputs_valsetisdict[Any, list[tuple[int, Prediction]]]. - ›Adds a
ValueErrorwhenreflection_prompt_templateis passed viagepa_kwargstodspy.GEPA, directing users to theinstruction_proposerparameter 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, ordspy.Filefrom 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/verifyoptions 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.
- !
numpyis no longer installed with basedspy; installpip install 'dspy[numpy]'to restore embeddings, KNN/KNNFewShot, SIMBA, and other NumPy-backed paths. - !
DspyGEPAResult.candidatesis now a list of compiled DSPy modules (not instruction dictionaries),DspyGEPAResult.best_candidateis a compiled DSPy module,val_subscoresislist[dict[Any, float]],per_val_instance_best_candidatesisdict[Any, set[int]],best_outputs_valsetisdict[Any, list[tuple[int, Prediction]]], andhighest_score_achieved_per_val_taskis 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_iterationsis renamed toRLM.max_iters; code passingmax_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.
- ›Adds
- 3.2.0
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 ITChain prompt and weight optimization steps in sequence, falling back to the best result at each stage.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.import dspy dspy.configure_cache(restrict_pickle=True)
Silence type-mismatch warnings when you intentionally pass loosely-typed values to DSPy signatures.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.loadwith a restricted unpickler that only allows litellm/openai types, numpy reconstruction helpers, and user-registeredsafe_types, preventing arbitrary code execution from malicious cache files. - ›Adds
verifyparameter to Image for SSL bypass. - ›Adds
EmbeddingsWithScoresretriever for direct access to similarity scores alongside retrieval results. - ›Adds XMLAdapter to DSPy.
+4 moreshow less
- ›Adds file output support to
inspect_history. - ›
BetterTogethernow accepts arbitrary optimizers as keyword arguments and chains them viastrategystrings (e.g., BetterTogether(metric=m, p=GEPA(...),w=BootstrapFinetune(...)) withstrategy='p -> w -> p'), evaluating each step on a valset and returning the best program. - ›
BaseLMnow exposes capability properties (supports_function_calling,supports_reasoning,supports_response_schema,supported_params) so custom backends integrate with DSPy's retry/truncation logic without anylitellmdependency;dspy.ContextWindowExceededErrorreplaces thelitellmerror throughout. - ›
optunais now an optional dependency installable viapip install dspy[optuna]; only MIPROv2 andBootstrapFewShotWithOptunarequire it.
└──▷ BREAKING ON UPGRADE- !
optunais no longer installed by default; workflows using MIPROv2 orBootstrapFewShotWithOptunamust now runpip install dspy[optuna]to restore the dependency.
- ›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
- 3.1.2
DSPy 3.1.2 exposes
timeoutandstraggler_limitparams 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
timeoutandstraggler_limitparameters in Parallel to control execution time limits and straggler handling in parallel pipelines.
- ›Exposes
- 3.1.1
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 ITPersist your current DSPy LM and settings to disk so a pipeline can be restored without reconfiguring.import dspy dspy.settings.save('dspy_settings.json') # later, in another process: dspy.settings.load('dspy_settings.json')- ›Adds
dspy.RLMmodule for reinforcement learning-style module execution, backed by an improvedPythonInterpreter. - ›Adds
saveandloadmethods 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
StreamListenerto support generic type annotations for output, enabling typed streaming results. - ›Uses
languagefield in system instructions fordspy.Codefields to guide code-generation formatting.
└──▷ BREAKING ON UPGRADE- !
FinalAnswerResultis renamed toFinalOutputindspy.RLM, and theRLM.__call__method is removed — code callingRLMas a callable or referencingFinalAnswerResultwill break.
- ›Adds
- 3.1.0
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 ITCapture native reasoning traces from a reasoning model (e.g. o3) alongside the final answer.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.Reasoningtype 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
ChatAdapterto prevent silent adapter fallback during inference. - ›Adds guards against loading
.pklfiles by default, and a parameter toload_memory_cacheto 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.
- ›Adds
- 3.0.4
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 ITExecute a tool call returned by the model directly, rather than dispatching it manually.result = tool_call.execute()
- ›Adds
gepa_kwargsparameter to pass custom keyword arguments togepa.optimize, enabling per-run optimizer configuration. - ›Adds
ToolCall.executemethod for smoother programmatic tool execution in agentic pipelines. - ›Adds
saveandloadmethods to Embeddings for persisting embedding state. - ›Exposes
dspy.evaluate.EvaluationResultas a first-class public symbol. - ›Adds Anthropic Citation API support, with a new
dspy.Documentprimitive and citation-aware response handling.
+10 moreshow less
- ›Adds custom
instruction_proposersupport to GEPA, including multimodaldspy.Imagehandling. - ›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.txtgeneration for documentation via themkdocs-llmstxtplugin. - ›Supports CSV output (PR #8725), expanding the formats available for evaluation results.
- ›Caches
Image.formatfor improved throughput when working withdspy.Imageinputs. - ›Deprecates
Image.from_*helper methods in favor of a flexible unified Image constructor.
- ›Adds
- 3.0.3
DSPy 3.0.3 adds
rollout_idfor 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_idparameter 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.
- ›Adds
- 3.0.2
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
LMclass, enabling use of that endpoint alongside existing chat/completion modes. - ›Allows custom chunk types in streaming via
dspy.LMstream handling, giving callers control over how streamed output is parsed. - ›Recognizes
gpt-5-nanoas a reasoning model, applying appropriate inference behavior automatically.
- ›Supports the OpenAI Responses API inside the
- 3.0.0
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 ITOptimize a DSPy program's prompts with GEPA to get a Pareto-optimal, shorter prompt that outperforms MIPROv2 on your task.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.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.GRPOreinforcement-learning optimizer for compound AI systems via the new Arbor library. - ›Adds
dspy.SIMBAprompt optimizer that learns from custom feedback, suited for agentic and long-horizon tasks. - ›Adds
dspy.BAMLAdapteralongside built-indspy.ChatAdapter,dspy.JSONAdapter, anddspy.XMLAdapter, with token/status streaming, async paths, and intelligent fallback to native LLM structured outputs. - ›Adds
dspy.Typebase class enabling custom types to work automatically with all adapters.
+14 moreshow less
- ›Adds multimodal I/O via
dspy.Imageanddspy.Audiotypes, including composite types such aslist[dspy.Image]and Pydantic models. - ›Adds
dspy.Historyanddspy.ToolCallshigher-level I/O types. - ›Adds
dspy.CodeActanddspy.Refinemodules, and a more reliablePythonInterpreter. - ›Adds
dspy.syncifyutility for running optimizers on async DSPy programs. - ›Adds
dspy.Codetype (landed in b3). - ›Adds
Module.batchwith 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.Programalias is removed; replace all uses with the concrete class. - !Legacy
functional/anddsp/clients, old caches, examples, and tests removed (deprecations promised in 2.5 applied during 2.6 release candidates). - !
BaseTyperenamed to Type (dspy.Type); any code referencingBaseTypewill break.
- ›Adds
- 3.0.0b3
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 ITUsedspy.Codeas a typed output field in a signature to elicit structured code responses from the LM.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.Codetype for use in signatures, with an optionallanguageparameter to specify the programming language of the expected code output. - ›Adds
dspy.syncifyto wrap async DSPy programs so they can be run through optimizers in synchronous contexts. - ›Adds token streaming support for XMLAdapter.
- ›Renames
dspy.BaseTypetodspy.Typeas the base class for custom structured types.
└──▷ BREAKING ON UPGRADE- !
dspy.BaseTypeis renamed todspy.Type; code referencingdspy.BaseTypewill break after upgrading.
- ›Adds
- 3.0.0b2
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 ITUse modern Python union type syntax in an inline DSPy signature instead oftyping.Union.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.import dspy lm = dspy.LM('gemini/gemini-1.5-pro') dspy.configure(lm=lm)- ›Adds
formatparameter toToolCallsfor controlling tool call output format. - ›Supports PEP 604 union types (e.g.
int | str) in inline signatures, enabling modern Python type hint syntax indspy.Signaturedefinitions. - ›Adds Gemini as a supported LM provider.
- ›Changes default model for the Databricks provider to
llama-4. - ›Allows reusing the
StreamListeneracross multiple streaming calls.
+3 moreshow less
- ›Changes the output interface of
evaluate— the return value ofdspy.Evaluatehas changed. - ›Removes
pandasanddatasetsfrom 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.Programalias is removed; usedspy.Moduledirectly. - !Python 3.9 is no longer supported; upgrade to Python 3.10 or higher.
- !
pandasanddatasetsare no longer installed as core dependencies; code that relied on them being available transitively will break. - !The output interface of
evaluate(thedspy.Evaluatereturn value) has changed. - !The Hyperparameter class is removed.
- !The experimental module is removed.
- !
dspy.settingsentries related todspy.Assertionare removed. - !The
awsextra dependency group is removed; AWS-related dependencies must now be installed separately.
- ›Adds
- 3.0.0b1
DSPy 3.0.0b1 adds a global
max_errorssetting, an XML adapter, expandedPythonInterpreterpermissions, 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 ITCap how many LM call errors a DSPy program tolerates before aborting, useful for guarding expensive optimization runs.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_errorssetting (viadspy.settings) to cap the number of errors tolerated across a DSPy program run. - ›Adds
xml adapteras a new prompt/response adapter alongside the existing JSON adapter. - ›Expands permission capabilities in
PythonInterpreterto support broader sandboxed code execution scenarios. - ›Supports automatic async-to-sync conversion for tools used in
dspy.ReActand 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.
- ›Adds global
- 2.6.26
DSPy 2.6.26 adds
dspy.Toolas an input field type anddspy.ToolCallas 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 ITDefine 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.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.Toolas an input field type anddspy.ToolCallas an output field type, enabling typed tool-calling signatures in DSPy programs.
- ›Supports
- 2.6.25
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 ITPass audio data as a typed Signature field to a DSPy module for multimodal LM tasks.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.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.Audioas a new built-in field type for passing audio inputs through Signatures. - ›Adds
CodeActmodule (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
cloudpicklefor more robust program save/load workflows. - ›Extends
dspy.Imageto acceptgs://URLs from Google Cloud Platform. - ›Supports Python 3.13.
- ›Streaming support extended to models that do not split stream chunks at token boundaries.
- ›Adds
- 2.6.24
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 ITCatch adapter parse failures separately from other errors when running a DSPy module.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
AdapterParseErrorexception class todspyfor catching adapter parsing failures programmatically. - ›Adds
GRPOoptimizer 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_tokensto surface misconfiguration earlier.
- ›Adds
- 2.6.23
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.
- 2.6.22
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
dspyMCP 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.
- ›Adds async execution path to
- 2.6.20
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 ITWrap an MCP tool as a DSPy tool to use it inside a ReAct agent on the same day MCP tools are available.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_toolclass method to construct adspy.Tooldirectly 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.
- ›Adds
- 2.6.19
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 ITPass kwargs-accepting functions directly as ReAct tools when the tool signature is dynamic or variadic.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.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
kwargsindspy.Tool, allowing tools to accept variable keyword arguments. - ›Allows overwriting
max_iterat runtime inReAct, 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.
- ›Supports composite argument type parsing in
- 2.6.18
DSPy 2.6.18 adds global
num_threads/provide_tracebacksettings, a two-step adapter, streaming support, and default args indspy.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 ITSet thread concurrency and traceback behavior once at startup rather than on every call.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 adspy.Toolwithout manually supplying defaults on every invocation.import dspy def search(query: str, top_k: int = 5) -> list: ... tool = dspy.Tool(search) # default top_k=5 is preserved automatically- ›Moves
num_threadsintodspy.settingsso thread concurrency can be configured globally instead of per-call. - ›Moves
provide_tracebackintodspy.settingsfor 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.
- ›Moves
- 2.6.16
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.
- 2.6.15
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.SIMBAoptimizer with an accompanying Tool-Use Tutorial. - ›Allows
dspy.ChainOfThoughtto be more customizable. - ›Allows
dspy.ProgramOfThoughtto accept multiple output fields.
- ›Adds experimental
- 2.6.14
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 ITUsePythonInterpreteras a context manager to ensure proper cleanup after sandboxed code execution.from dspy.predict.python_interpreter import PythonInterpreter with PythonInterpreter() as interpreter: result = interpreter("output = 2 + 2") print(result)- ›Adds context-manager protocol (
withstatement) support toPythonInterpreter, enabling cleaner resource management when executing sandboxed Python code. - ›Introduces
construct_result_tablemethod on the Evaluate class, exposing structured result tables from evaluation runs.
- ›Adds context-manager protocol (
- 2.6.13
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 ITSend an image input through the JSON adapter for multimodal LM tasks.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.BaseLMextensible, allowing custom LM subclasses to override and extend base behavior. - ›Adds
compileandget_paramsmethods to the Teleprompter base class, standardizing the optimizer interface. - ›Allows
dspy.ChatAdapterparser to accept field headers and content on the same line, broadening the range of parseable model outputs.
+1 moreshow less
- ›Improves
dspy.BestOfNwith enhanced error handling.
- ›Adds image support to
- 2.6.12
DSPy 2.6.12 adds
callback_metadatato evaluate and simplifiesdspy.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_metadataparameter to theevaluatefunction, enabling richer context to be passed through evaluation callbacks. - ›Simplifies the
dspy.LMinterface.
- ›Adds
- 2.6.11
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 dspystartup.
- ›Adds timeout-based straggler resubmission in
- 2.6.10
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_urlcontent, enabling multimodal inputs beyond images.
- ›Supports non-image MIME types in
- 2.6.9
DSPy 2.6.9 adds multi-turn history support, an evaluate callback, and a
provide_tracebackoption 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_tracebackto 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.
- ›Allows passing
- 2.6.6
DSPy 2.6.6 adds
dspy.Refineanddspy.BestOfNmodules 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.Refinemodule for iterative refinement of generated outputs. - ›Adds
dspy.BestOfNmodule for sampling multiple candidate outputs and selecting the best one.
- ›Adds
- 2.6.5
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.
- 2.6.3
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
ReActto prevent runaway context growth in long agentic loops. - ›Improves
dspy.Toolwith enhancements to tool invocation behavior.
- ›Supports status streaming via
- 2.6.2
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
InferRulesoptimizer for automated rule inference during prompt optimization. - ›Supports arbitrary
dspy.Imageobjects inside DSPy examples, enabling multimodal training and optimization workflows.
- ›Adds
- 2.6.1
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 ITDisable all DSPy caching in a production environment where you want no disk or memory cache overhead.$ DSP_CACHEBOOL=false python my_dspy_app.pyUse o3-mini as your language model for a DSPy program.import dspy lm = dspy.LM('openai/o3-mini') dspy.configure(lm=lm)- ›Adds
DSP_CACHEBOOLenvironment 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_cachefor cleaner local storage layout. - ›Adds support for
o3-miniand other OpenAI reasoning models in thelmmodule.
+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.
- ›Adds
- 2.6.0
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
RetryPolicyintegration. - ›Improves
BootstrapFToptimizer relative to the 2.4 baseline. - ›Adds argument parsing support for
dspy.ReAct.
+2 moreshow less
- ›Improves Literal type format adherence in
ChatAdapterand 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.
- ›Adds streaming support via
- 2.6.0rc8
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 ITCheck the installed DSPy version at runtime without parsing package metadata.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
BootstrapFToptimizer behavior. - ›Allows
DatabricksRMto return empty results when no documents are retrieved, instead of raising an error.
- ›Exposes
- 2.6.0rc6
DSPy 2.6.0rc6 adds
response_modelkey 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_modelkey to LM history entries, exposing the structured output model used for each language model call.
- ›Adds
- 2.6.0rc4
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.
- 2.6.0rc3
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
RetryPolicyintegration. - ›Refines thread-safety semantics for Settings to make concurrent DSPy usage more reliable.
- ›Supports automatic retries for LM calls via LiteLLM
- 2.5.43
DSPy 2.5.43 adds logprob support in Predictor and a new
docs_uri_column_namefield 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 ITRetrieve documents from Databricks Vector Search and map a custom URI column to results.retriever = DatabricksRM( databricks_index_name='my_index', docs_uri_column_name='source_url', text_column_name='content', k=5 )- ›Adds
docs_uri_column_nameparameter toDatabricksRMto 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.
- ›Adds
- 2.5.42
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_startandon_tool_endcallbacks for observability hooks around tool execution. - ›Integrates
cachetoolsfor 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
DatabricksRMcompatible with the Mosaic agent framework.
- ›Adds
- 2.5.41
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.
- ›Includes the Signature
- 2.5.40
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 ITRegister a class method as a ReAct tool so stateful or object-oriented tooling can be used directly in a ReAct pipeline.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.Toolto 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.
- ›Allows
- 2.5.36
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.settingsto aContextVar, enabling per-thread/per-context isolation of DSPy configuration. - ›Extends
ParallelExecutorto 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.
- ›Converts
- 2.5.35
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.
- 2.5.34
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
CompleteAndGroundedmetric for evaluating whether generated outputs are both complete and grounded in source context. - ›Introduces Unbatchify utility for converting batched outputs back into individual items.
- ›Adds
- 2.5.33
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.
- 2.5.30
DSPy 2.5.30 adds
dspy.asyncifyfor 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 ITWrap a synchronous DSPy module to run asynchronously in an async context, avoiding blocking the event loop.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.asyncifyto wrap synchronous DSPy modules for asynchronous execution. - ›Adds native parallel execution support via
ParallelExecutorfor running DSPy programs concurrently.
- ›Adds
- 2.5.29
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.
- 2.5.28
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.LMto suppress LiteLLM log output, reducing noise when running DSPy programs. - ›Revamps
BootstrapFinetuneand promotes theBetterTogetheroptimizer from experimental to main, making combined few-shot and fine-tuning optimization available in the standard release.
- ›Adds a flag to
- 2.5.26
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
structlogdependency, reducing the library's install footprint. - ›Adds automatic retry with exponential backoff for LM calls on a limited set of error codes.
- ›Removes the
- 2.5.23
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.
- 2.5.21
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
ReActto handle tool functions that have no docstring, removing a previous hard requirement on function documentation.
└──▷ BREAKING ON UPGRADE- !The
retry_strategyparameter has been removed fromLM; existing code that setsretry_strategywill break on upgrade.
- 2.5.17
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
JsonAdapteras a new adapter alongside the improvedChatAdapter, 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.TypedPredictorand its variants are deprecated — callers should migrate todspy.Predict,dspy.ChainOfThought, or other standard predictors.
- ›Adds
- 2.5.11
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
SemanticF1metric for evaluating semantic similarity between predicted and expected answers.
- ›Adds
- 2.5.10
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.
- 2.5.9
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.
- ›Adds reasoning/rationale support to
- 2.5.4
DSPy 2.5.4 adds
num_retriesto 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_retriesparameter tosignature_opt_typedto 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.
- ›Adds
- 2.5.1
DSPy 2.5.1 publishes to the
dspyPyPI package name alongsidedspy-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
dspyon PyPI in addition todspy-ai, so users can install withpip install dspy.
- ›Publishes the package to
- 2.5.0
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.
- 2.4.16
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.LManddspy.Adapterclasses, foundational new interfaces for language model and adapter management in DSPy 2.5 onwards (existing clients are unaffected). - ›Supports o1 model parameters in
dspyLM configuration. - ›Enables LangChain objects to be copied within DSPy workflows.
- ›Adds
- 2.4.13
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 ITSlow down retry pressure on rate-limited LM providers by setting a custom backoff interval at startup.dspy.settings.configure(backoff_time=5)
- ›Adds
backoff_timeparameter to dspy.settings.configure() for configurable retry backoff across LM/RM providers. - ›Adds LangChain Tool Execution support.
- ›Adds
- v2.4.12
DSPy v2.4.12 lets you compile
dspy.Predictanddspy.ChainOfThoughtdirectly 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.Predictanddspy.ChainOfThoughtdirectly as Modules without wrapping them in adspy.Moduleobject. - ›Improves the
experimental=TrueChat 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.
- ›Supports compiling
- v2.4.11
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 ITActivate the new Chat LM adapters to get more predictable zero-shot outputs without changing your existing DSPy program logic.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.