Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(azure_ai/): fix transformation to handle when models don't support tool_choice

Krrish Dholakia1051478e956d
diff --git a/litellm/llms/azure_ai/chat/transformation.py b/litellm/llms/azure_ai/chat/transformation.py
index 46a1a6bf9cd..2ef5285ac6e 100644
--- a/litellm/llms/azure_ai/chat/transformation.py
+++ b/litellm/llms/azure_ai/chat/transformation.py
@@ -16,10 +16,23 @@ from litellm.llms.openai.openai import OpenAIConfig
from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import ModelResponse, ProviderField
-from litellm.utils import _add_path_to_api_base
+from litellm.utils import _add_path_to_api_base, supports_tool_choice
class AzureAIStudioConfig(OpenAIConfig):
+ def get_supported_openai_params(self, model: str) -> List:
+ model_supports_tool_choice = True # azure ai supports this by default
+ if not supports_tool_choice(model=f"azure_ai/{model}"):
+ model_supports_tool_choice = False
+ supported_params = super().get_supported_openai_params(model)
+ if not model_supports_tool_choice:
+ filtered_supported_params = []
+ for param in supported_params:
+ if param != "tool_choice":
+ filtered_supported_params.append(param)
+ return filtered_supported_params
+ return supported_params
+
def validate_environment(
self,
headers: dict,