11# Copyright (c) Microsoft. All rights reserved.
22
33
4+ import logging
45from typing import Annotated , Any , ClassVar , TypeVar
5- from warnings import warn
66
77from pydantic import BaseModel , ConfigDict , Field , UrlConstraints
88from pydantic .networks import AnyUrl
99from pydantic_settings import BaseSettings , SettingsConfigDict
1010
1111HttpsUrl = Annotated [AnyUrl , UrlConstraints (max_length = 2083 , allowed_schemes = ["https" ])]
1212
13+ logger = logging .getLogger ("semantic_kernel" )
14+
1315
1416class KernelBaseModel (BaseModel ):
1517 """Base class for all pydantic models in the SK."""
@@ -51,7 +53,6 @@ def __init__(
5153 """Initialize the settings class."""
5254 # Remove any None values from the kwargs so that defaults are used.
5355 kwargs = {k : v for k , v in kwargs .items () if v is not None }
54-
5556 super ().__init__ (** kwargs )
5657
5758 def __new__ (cls : type ["T" ], * args : Any , ** kwargs : Any ) -> "T" :
@@ -76,5 +77,7 @@ def __new__(cls: type["T"], *args: Any, **kwargs: Any) -> "T":
7677 @classmethod
7778 def create (cls : type ["T" ], ** data : Any ) -> "T" :
7879 """Update the model_config with the prefix."""
79- warn ("Create is deprecated, use the class constructor instead." , DeprecationWarning , 2 )
80+ logger .warning (
81+ "The create method is deprecated. Use the __new__ method instead." ,
82+ )
8083 return cls (** data )
0 commit comments