mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix: don't fail request if unmapped item in responses list
not every responses item has a 1:1 mapping with chat completions
This commit is contained in:
parent
e8a748161f
commit
f4131b023e
2 changed files with 6 additions and 7 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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"}},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue