diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py index 40e35cc0f6..8efe6e1699 100644 --- a/studio/backend/routes/inference.py +++ b/studio/backend/routes/inference.py @@ -1205,12 +1205,16 @@ async def openai_chat_completions( # Only strip closed pairs here (not open-ended) # so legitimate text after a tool block is kept. cumulative = _re.sub( - r".*?", "", - cumulative, flags = _re.DOTALL, + r".*?", + "", + cumulative, + flags = _re.DOTALL, ) cumulative = _re.sub( - r".*?", "", - cumulative, flags = _re.DOTALL, + r".*?", + "", + cumulative, + flags = _re.DOTALL, ) new_text = cumulative[len(prev_text) :] prev_text = cumulative