From f4131b023ee56050a87f14a31947581c31c0fc39 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 16 Jul 2025 09:24:01 -0700 Subject: [PATCH] fix: don't fail request if unmapped item in responses list not every responses item has a 1:1 mapping with chat completions --- .../transformation.py | 11 +++++------ tests/llm_translation/test_openai.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index 43fb64b69ea..42f5c2b6a50 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -277,13 +277,8 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): Choices(message=msg, finish_reason="tool_calls", index=index) ) index += 1 - elif isinstance(item, GenericResponseOutputItem): - raise ValueError("GenericResponseOutputItem not supported") - elif isinstance(item, OutputFunctionToolCall): - # function/tool calls pass through as-is - raise ValueError("Function calling not supported yet.") else: - raise ValueError(f"Unknown item type: {item}") + pass # don't fail request if item in list is not supported if len(choices) == 0: if ( @@ -293,6 +288,10 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): raise ValueError( f"{model} unable to complete request: {raw_response.incomplete_details.reason}" ) + else: + raise ValueError( + f"Unknown items in responses API response: {raw_response.output}" + ) setattr(model_response, "choices", choices) diff --git a/tests/llm_translation/test_openai.py b/tests/llm_translation/test_openai.py index e8c5adacc1a..1145d8c3469 100644 --- a/tests/llm_translation/test_openai.py +++ b/tests/llm_translation/test_openai.py @@ -552,7 +552,7 @@ def test_openai_deepresearch_model_bridge(): litellm._turn_on_debug() response = litellm.completion( model="o3-deep-research-2025-06-26", - messages=[{"role": "user", "content": "What is the capital of France?"}], + messages=[{"role": "user", "content": "Hey, how's it going?"}], tools=[ {"type": "web_search_preview"}, {"type": "code_interpreter", "container": {"type": "auto"}},