Skip to content

Commit

Permalink
fix: Fixing the confilict for pydantic v2+ and the semantic_kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
ghhabib2 committed Feb 6, 2025
1 parent 1b735c7 commit 7ab585e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/semantic_kernel/functions/kernel_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from types import MethodType
from typing import TYPE_CHECKING, Annotated, Any, TypeVar

from pydantic import Field, StringConstraints
from pydantic import Field

from semantic_kernel.data.text_search.text_search import TextSearch
from semantic_kernel.exceptions import PluginInitializationError
Expand Down Expand Up @@ -75,7 +75,7 @@ class KernelPlugin(KernelBaseModel):
"""

name: Annotated[str, StringConstraints(pattern=PLUGIN_NAME_REGEX, min_length=1)]
name: Annotated[str, Field(min_length=1, pattern=PLUGIN_NAME_REGEX)]
description: str | None = None
functions: dict[str, KernelFunction] = Field(default_factory=dict)

Expand Down
4 changes: 2 additions & 2 deletions python/semantic_kernel/services/ai_service_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC
from typing import TYPE_CHECKING, Annotated

from pydantic import Field, StringConstraints
from pydantic import Field

from semantic_kernel.kernel_pydantic import KernelBaseModel

Expand All @@ -22,7 +22,7 @@ class AIServiceClientBase(KernelBaseModel, ABC):
The service_id is used in Semantic Kernel to identify the service, if empty the ai_model_id is used.
"""

ai_model_id: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)]
ai_model_id: Annotated[str, Field(min_length=1)]
service_id: str = Field("")

def model_post_init(self, __context: object | None = None):
Expand Down

0 comments on commit 7ab585e

Please sign in to comment.