Skip to content

Commit 81a6dea

Browse files
addressed feedback
1 parent 082e600 commit 81a6dea

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

python/samples/concepts/setup/chat_completion_services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def get_openai_chat_completion_service_and_request_settings(
9494
"""
9595
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion, OpenAIChatPromptExecutionSettings
9696

97-
chat_service = OpenAIChatCompletion(service_id=service_id, instruction_role=instruction_role, env_file_path=".env")
97+
chat_service = OpenAIChatCompletion(service_id=service_id, instruction_role=instruction_role)
9898
request_settings = OpenAIChatPromptExecutionSettings(
9999
service_id=service_id, max_tokens=2000, temperature=0.7, top_p=0.8
100100
)

python/semantic_kernel/kernel_pydantic.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

33

4+
import logging
45
from typing import Annotated, Any, ClassVar, TypeVar
5-
from warnings import warn
66

77
from pydantic import BaseModel, ConfigDict, Field, UrlConstraints
88
from pydantic.networks import AnyUrl
99
from pydantic_settings import BaseSettings, SettingsConfigDict
1010

1111
HttpsUrl = Annotated[AnyUrl, UrlConstraints(max_length=2083, allowed_schemes=["https"])]
1212

13+
logger = logging.getLogger("semantic_kernel")
14+
1315

1416
class 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

Comments
 (0)