diff --git a/litellm/utils.py b/litellm/utils.py index 88b85feff..f82ae1e44 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -19,7 +19,7 @@ from functools import wraps, lru_cache import datetime, time import tiktoken import uuid -from pydantic import ConfigDict, BaseModel, VERSION +from pydantic import BaseModel import aiohttp import textwrap import logging @@ -185,23 +185,6 @@ last_fetched_at_keys = None # } -# Function to get Pydantic version -def is_pydantic_v2() -> int: - return int(VERSION.split(".")[0]) - - -def get_model_config(arbitrary_types_allowed: bool = False) -> ConfigDict: - # Version-specific configuration - if is_pydantic_v2() >= 2: - model_config = ConfigDict(extra="allow", arbitrary_types_allowed=arbitrary_types_allowed, protected_namespaces=()) # type: ignore - else: - from pydantic import Extra - - model_config = ConfigDict(extra=Extra.allow, arbitrary_types_allowed=arbitrary_types_allowed) # type: ignore - - return model_config - - class UnsupportedParamsError(Exception): def __init__(self, status_code, message): self.status_code = status_code @@ -348,7 +331,10 @@ class HiddenParams(OpenAIObject): original_response: Optional[str] = None model_id: Optional[str] = None # used in Router for individual deployments api_base: Optional[str] = None # returns api base used for making completion call - model_config = get_model_config() + + class Config: + extra = "allow" + protected_namespaces = () def get(self, key, default=None): # Custom .get() method to access attributes with a default value if the attribute doesn't exist