mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-14 04:09:09 +00:00
test: preserve responses custom provider during container decode
This commit is contained in:
parent
048ec5d082
commit
ec674422eb
2 changed files with 30 additions and 0 deletions
|
|
@ -5530,6 +5530,8 @@ class Router:
|
|||
**kwargs,
|
||||
):
|
||||
if call_type == "responses":
|
||||
if custom_llm_provider and "custom_llm_provider" not in kwargs:
|
||||
kwargs["custom_llm_provider"] = custom_llm_provider
|
||||
self._decode_responses_api_tool_container_ids(kwargs)
|
||||
return self._generic_api_call_with_fallbacks(original_function=original_function, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -805,6 +805,34 @@ async def test_router_aresponses_decodes_managed_tool_container_id_without_routi
|
|||
assert kwargs["tools"][0]["container"] == "cntr_native_123"
|
||||
|
||||
|
||||
def test_router_responses_preserves_custom_provider_when_decoding_managed_tool_container_id():
|
||||
from litellm.responses.utils import ResponsesAPIRequestUtils
|
||||
|
||||
router = Router(model_list=[])
|
||||
router._generic_api_call_with_fallbacks = MagicMock(return_value={"id": "resp_1"})
|
||||
|
||||
encoded_container_id = ResponsesAPIRequestUtils._build_container_id(
|
||||
custom_llm_provider="azure",
|
||||
model_id="azure-deployment-id",
|
||||
container_id="cntr_native_123",
|
||||
)
|
||||
tools = [{"type": "code_interpreter", "container": encoded_container_id}]
|
||||
|
||||
response = router.responses(
|
||||
model="logical-model",
|
||||
input="hello",
|
||||
tools=tools,
|
||||
custom_llm_provider="openai",
|
||||
)
|
||||
|
||||
call_kwargs = router._generic_api_call_with_fallbacks.call_args.kwargs
|
||||
assert response == {"id": "resp_1"}
|
||||
assert call_kwargs["model"] == "logical-model"
|
||||
assert call_kwargs["custom_llm_provider"] == "openai"
|
||||
assert call_kwargs["tools"][0]["container"] == "cntr_native_123"
|
||||
assert tools[0]["container"] == encoded_container_id
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_vector_store_api_endpoints():
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue