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]

Merge origin/main into litellm_fix_openai_init_params_immutable

Ryan Crabbe72e75c112242
diff --cc litellm/llms/openai/common_utils.py
index df9c78cdcc5,5f9559df771..a89f7f9c2b9
--- a/litellm/llms/openai/common_utils.py
+++ b/litellm/llms/openai/common_utils.py
@@@ -3,10 -3,9 +3,10 @@@ Common helpers / utils across al OpenA
"""
import hashlib
+import inspect
import json
import ssl
- from typing import Any, Dict, List, Literal, Optional, Tuple, TYPE_CHECKING, Union
-from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union
++from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union
import httpx
import openai
@@@ -23,13 -24,14 +23,13 @@@ from litellm.llms.custom_httpx.http_han
get_ssl_configuration,
)
-
-def _get_client_init_params(cls: type) -> List[str]:
+def _get_client_init_params(cls: type) -> Tuple[str, ...]:
"""Extract __init__ parameter names (excluding 'self') from a class."""
- return tuple(p for p in inspect.signature(cls.__init__).parameters if p != "self")
- return [p for p in inspect.signature(cls.__init__).parameters if p != "self"] # type: ignore[misc]
++ return tuple(p for p in inspect.signature(cls.__init__).parameters if p != "self") # type: ignore[misc]
-_OPENAI_INIT_PARAMS: List[str] = _get_client_init_params(OpenAI)
-_AZURE_OPENAI_INIT_PARAMS: List[str] = _get_client_init_params(AzureOpenAI)
+_OPENAI_INIT_PARAMS: Tuple[str, ...] = _get_client_init_params(OpenAI)
+_AZURE_OPENAI_INIT_PARAMS: Tuple[str, ...] = _get_client_init_params(AzureOpenAI)
class OpenAIError(BaseLLMException):