mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix: forward eager_input_streaming through the Responses API tool bridge
This commit is contained in:
parent
a37d1e8b9b
commit
e5fd2bec83
2 changed files with 36 additions and 0 deletions
|
|
@ -2020,6 +2020,8 @@ class LiteLLMCompletionResponsesConfig:
|
|||
chat_completion_tool["allowed_callers"] = tool.get("allowed_callers")
|
||||
if tool.get("input_examples"):
|
||||
chat_completion_tool["input_examples"] = tool.get("input_examples")
|
||||
if tool.get("eager_input_streaming") is not None:
|
||||
chat_completion_tool["eager_input_streaming"] = tool.get("eager_input_streaming")
|
||||
return ResponsesToolChatForm(
|
||||
chat_tools=(cast(ChatCompletionToolParam, chat_completion_tool),), web_search_options=None
|
||||
)
|
||||
|
|
@ -2096,6 +2098,8 @@ class LiteLLMCompletionResponsesConfig:
|
|||
responses_tool["allowed_callers"] = tool.get("allowed_callers")
|
||||
if tool.get("input_examples") is not None:
|
||||
responses_tool["input_examples"] = tool.get("input_examples")
|
||||
if tool.get("eager_input_streaming") is not None:
|
||||
responses_tool["eager_input_streaming"] = tool.get("eager_input_streaming")
|
||||
result.append(responses_tool)
|
||||
else:
|
||||
# mcp or other: pass through unchanged
|
||||
|
|
|
|||
|
|
@ -1900,6 +1900,38 @@ class TestToolTransformation:
|
|||
assert "defer_loading" not in result_tool
|
||||
assert "allowed_callers" not in result_tool
|
||||
assert "input_examples" not in result_tool
|
||||
assert "eager_input_streaming" not in result_tool
|
||||
|
||||
@pytest.mark.parametrize("eager_input_streaming", [True, False])
|
||||
def test_transform_function_tools_forwards_eager_input_streaming(self, eager_input_streaming: bool) -> None:
|
||||
function_tool: Final = {
|
||||
"type": "function",
|
||||
"name": "write_file",
|
||||
"parameters": {"type": "object", "properties": {"path": {"type": "string"}}},
|
||||
"eager_input_streaming": eager_input_streaming,
|
||||
}
|
||||
|
||||
result_tools, _ = LiteLLMCompletionResponsesConfig.transform_responses_api_tools_to_chat_completion_tools(
|
||||
tools=[function_tool]
|
||||
)
|
||||
|
||||
assert result_tools[0]["eager_input_streaming"] is eager_input_streaming
|
||||
|
||||
@pytest.mark.parametrize("eager_input_streaming", [True, False])
|
||||
def test_chat_completion_tools_to_responses_tools_keeps_eager_input_streaming(
|
||||
self, eager_input_streaming: bool
|
||||
) -> None:
|
||||
chat_tool: Final = {
|
||||
"type": "function",
|
||||
"function": {"name": "write_file", "parameters": {"type": "object"}},
|
||||
"eager_input_streaming": eager_input_streaming,
|
||||
}
|
||||
|
||||
result_tools: Final = LiteLLMCompletionResponsesConfig.transform_chat_completion_tool_params_to_responses_api_tools(
|
||||
[chat_tool]
|
||||
)
|
||||
|
||||
assert result_tools[0]["eager_input_streaming"] is eager_input_streaming
|
||||
|
||||
def test_transform_code_execution_tools(self):
|
||||
"""Test that code_execution tools are passed through as-is"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue