From 265bf871bcb85ef09466b59d1cd93b02d2a0f79e Mon Sep 17 00:00:00 2001 From: daniel-meismer-zocdoc Date: Wed, 15 Jul 2026 16:03:07 -0400 Subject: [PATCH] fix(responses): accept empty function argument deltas (#33341) --- .../transformation.py | 2 +- ...responses_transformation_transformation.py | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index aecb2552b53..349fe9903ef 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -1196,7 +1196,7 @@ class OpenAiResponsesToChatCompletionStreamIterator(BaseModelResponseIterator): ) elif event_type == "response.function_call_arguments.delta": content_part: Optional[str] = parsed_chunk.get("delta", None) - if content_part: + if isinstance(content_part, str): tool_call_index = parsed_chunk.get("output_index", 0) return ModelResponseStream( choices=[ diff --git a/tests/test_litellm/completion_extras/test_litellm_responses_transformation_transformation.py b/tests/test_litellm/completion_extras/test_litellm_responses_transformation_transformation.py index 05bdc40112c..b432e6fd979 100644 --- a/tests/test_litellm/completion_extras/test_litellm_responses_transformation_transformation.py +++ b/tests/test_litellm/completion_extras/test_litellm_responses_transformation_transformation.py @@ -257,3 +257,24 @@ def test_translate_responses_chunk_passthrough_chat_completion_chunk(): assert result.choices[0].delta.content == "Hi! How can I help?" assert result.choices[0].finish_reason is None + + +def test_translate_responses_chunk_accepts_empty_function_argument_delta(): + from litellm.completion_extras.litellm_responses_transformation.transformation import ( + OpenAiResponsesToChatCompletionStreamIterator, + ) + + result = OpenAiResponsesToChatCompletionStreamIterator.translate_responses_chunk_to_openai_stream( + { + "type": "response.function_call_arguments.delta", + "item_id": "fc_test", + "output_index": 0, + "delta": "", + "sequence_number": 3, + } + ) + + tool_calls = result.choices[0].delta.tool_calls + assert tool_calls is not None + assert tool_calls[0].function is not None + assert tool_calls[0].function.arguments == ""