DSPy: The framework for programming—not prompting—language models
Python
Add gpt-5 as reasoning model (#8620)
Olesya Sharifyc899fcfaf56b
diff --git a/dspy/clients/lm.py b/dspy/clients/lm.pyindex 019859130..abc97a845 100644--- a/dspy/clients/lm.py+++ b/dspy/clients/lm.py@@ -79,7 +79,7 @@ class LM(BaseLM):model_family = model.split("/")[-1].lower() if "/" in model else model.lower()# Match pattern: o[1,3,4] at the start, optionally followed by -mini and anything else- model_pattern = re.match(r"^o([134])(?:-mini)?", model_family)+ model_pattern = re.match(r"^(?:o([1345])|gpt-(5))(?:-mini)?", model_family)if model_pattern:# Handle OpenAI reasoning models (o1, o3)