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]

get_supported_openai_params

Ishaan Jaff9e7c67805b3b
diff --git a/litellm/llms/azure/chat/o_series_transformation.py b/litellm/llms/azure/chat/o_series_transformation.py
index 0ca3a28d23e..938362871c1 100644
--- a/litellm/llms/azure/chat/o_series_transformation.py
+++ b/litellm/llms/azure/chat/o_series_transformation.py
@@ -22,6 +22,25 @@ from ...openai.chat.o_series_transformation import OpenAIOSeriesConfig
class AzureOpenAIO1Config(OpenAIOSeriesConfig):
+ def get_supported_openai_params(self, model: str) -> list:
+ """
+ Get the supported OpenAI params for the Azure O-Series models
+ """
+ all_openai_params = super().get_supported_openai_params(model=model)
+ non_supported_params = [
+ "logprobs",
+ "top_p",
+ "presence_penalty",
+ "frequency_penalty",
+ "top_logprobs",
+ ]
+
+ o_series_only_param = ["reasoning_effort"]
+ all_openai_params.extend(o_series_only_param)
+ return [
+ param for param in all_openai_params if param not in non_supported_params
+ ]
+
def should_fake_stream(
self,
model: Optional[str],
diff --git a/litellm/llms/openai/chat/o_series_transformation.py b/litellm/llms/openai/chat/o_series_transformation.py
index 461ee59ba74..b2ffda6e7de 100644
--- a/litellm/llms/openai/chat/o_series_transformation.py
+++ b/litellm/llms/openai/chat/o_series_transformation.py
@@ -14,8 +14,15 @@ Translations handled by LiteLLM:
from typing import List, Optional
import litellm
+from litellm import verbose_logger
+from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
from litellm.types.llms.openai import AllMessageValues, ChatCompletionUserMessage
-from litellm.utils import supports_system_messages
+from litellm.utils import (
+ supports_function_calling,
+ supports_parallel_function_calling,
+ supports_response_schema,
+ supports_system_messages,
+)
from .gpt_transformation import OpenAIGPTConfig
@@ -51,8 +58,41 @@ class OpenAIOSeriesConfig(OpenAIGPTConfig):
"frequency_penalty",
"top_logprobs",
]
+
o_series_only_param = ["reasoning_effort"]
+
all_openai_params.extend(o_series_only_param)
+
+ try:
+ model, custom_llm_provider, api_base, api_key = get_llm_provider(
+ model=model
+ )
+ except Exception:
+ verbose_logger.debug(
+ f"Unable to infer model provider for model={model}, defaulting to openai for o1 supported param check"
+ )
+ custom_llm_provider = "openai"
+
+ _supports_function_calling = supports_function_calling(
+ model, custom_llm_provider
+ )
+ _supports_response_schema = supports_response_schema(model, custom_llm_provider)
+ _supports_parallel_tool_calls = supports_parallel_function_calling(
+ model, custom_llm_provider
+ )
+
+ if not _supports_function_calling:
+ non_supported_params.append("tools")
+ non_supported_params.append("tool_choice")
+ non_supported_params.append("function_call")
+ non_supported_params.append("functions")
+
+ if not _supports_parallel_tool_calls:
+ non_supported_params.append("parallel_tool_calls")
+
+ if not _supports_response_schema:
+ non_supported_params.append("response_format")
+
return [
param for param in all_openai_params if param not in non_supported_params
]