diff --git a/litellm/litellm_core_utils/allowed_tools_tool_choice.py b/litellm/litellm_core_utils/allowed_tools_tool_choice.py index f633c4a5bfc..42a8fadf31e 100644 --- a/litellm/litellm_core_utils/allowed_tools_tool_choice.py +++ b/litellm/litellm_core_utils/allowed_tools_tool_choice.py @@ -124,12 +124,12 @@ def is_allowed_tools_choice(tool_choice: object) -> bool: return False -def _accepts_allowed_tools(custom_llm_provider: str, model: str, base_model: str | None) -> bool: +def _accepts_allowed_tools(custom_llm_provider: str, model: str, base_model: object) -> bool: match custom_llm_provider: case "azure_ai": from litellm.llms.azure_ai.common_utils import azure_ai_serves_openai_chat_model - return azure_ai_serves_openai_chat_model(model, base_model) + return azure_ai_serves_openai_chat_model(model, base_model if isinstance(base_model, str) else None) case _: return custom_llm_provider in PROVIDERS_ACCEPTING_ALLOWED_TOOLS @@ -140,7 +140,7 @@ def tool_choice_for_provider( custom_llm_provider: str, model: str, drop_params: bool, - base_model: str | None = None, + base_model: object = None, ) -> _ToolChoiceT | Mapping[str, JsonValue] | None: if not is_allowed_tools_choice(tool_choice): return tool_choice diff --git a/litellm/main.py b/litellm/main.py index 8d347b3e2af..77145c9e885 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -5726,7 +5726,6 @@ def completion( drop_unsupported_reasoning: Final = ( litellm.drop_params is True or normalize_drop_params(routing_kwargs.get("drop_params")) is True ) - drops_tool_choice: Final = drop_policy(routing_kwargs).drops("tool_choice") reasoning_model_group: Final = model_group_from_metadata( routing_kwargs.get("metadata"), routing_kwargs.get("litellm_metadata") ) @@ -5878,8 +5877,8 @@ def completion( _OPAQUE_VALUE_ADAPTER.validate_python(tool_choice), custom_llm_provider=custom_llm_provider, model=model, - drop_params=drops_tool_choice, - base_model=base_model if isinstance(base_model, str) else None, + drop_params=drop_policy(routing_kwargs).drops("tool_choice"), + base_model=_OPAQUE_VALUE_ADAPTER.validate_python(base_model), ), "max_retries": max_retries, "logprobs": logprobs,