From 3046b9f1636855d27998959906339d5d3fa76da3 Mon Sep 17 00:00:00 2001 From: Colin Lin Date: Fri, 5 Dec 2025 09:33:30 -0500 Subject: [PATCH] [stripe] opus budget thinking --- litellm/litellm_core_utils/prompt_templates/common_utils.py | 2 +- tests/litellm_utils_tests/test_utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py index c50ceeabdb..d2c91f4a84 100644 --- a/litellm/litellm_core_utils/prompt_templates/common_utils.py +++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py @@ -1071,7 +1071,7 @@ def _parse_content_for_reasoning( return None, message_text reasoning_match = re.match( - r"<(?:think|thinking)>(.*?)(.*)", message_text, re.DOTALL + r"<(?:think|thinking|budget:thinking)>(.*?)(.*)", message_text, re.DOTALL ) if reasoning_match: diff --git a/tests/litellm_utils_tests/test_utils.py b/tests/litellm_utils_tests/test_utils.py index bffcc91a7a..ddf97aeddb 100644 --- a/tests/litellm_utils_tests/test_utils.py +++ b/tests/litellm_utils_tests/test_utils.py @@ -1043,6 +1043,11 @@ def test_convert_model_response_object(): "I am thinking here", "The sky is a canvas of blue", ), + ( + "\nLet me work through this step by step.\n\n\nYou have **8 fruits** remaining.", + "\nLet me work through this step by step.\n", + "\n\nYou have **8 fruits** remaining.", + ), ("I am a regular response", None, "I am a regular response"), ], )