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): avoid mutable request mapping

David Steelebd222bd8d9f6
diff --git a/litellm/llms/azure/chat/gpt_transformation.py b/litellm/llms/azure/chat/gpt_transformation.py
index 7cb50ee5348..424422612db 100644
--- a/litellm/llms/azure/chat/gpt_transformation.py
+++ b/litellm/llms/azure/chat/gpt_transformation.py
@@ -280,11 +280,13 @@ class AzureOpenAIConfig(BaseConfig):
ordered_messages: Final = system_messages_first(messages) if litellm.openai_system_messages_first else messages
stripped_messages: Final = drop_tool_reference_parts_from_tool_messages(ordered_messages)
azure_messages: Final = convert_to_azure_openai_messages(hoist_images_from_tool_messages(stripped_messages))
- request_params: Final = {
- key: value
- for key, value in optional_params.items()
- if key != "tool_choice" or optional_params.get("tools") or optional_params.get("functions")
- }
+ request_params: Final = MappingProxyType(
+ {
+ key: value
+ for key, value in optional_params.items()
+ if key != "tool_choice" or optional_params.get("tools") or optional_params.get("functions")
+ }
+ )
return {
"model": model,
"messages": azure_messages,