Skip to content

Commit

Permalink
Remove pydantic v1 compat (#4838)
Browse files Browse the repository at this point in the history
Remove pydantic compat
  • Loading branch information
jackgerrits authored Dec 27, 2024
1 parent a5681d7 commit ad7433e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
get_origin,
)

from pydantic import BaseModel, Field, create_model # type: ignore
from pydantic import BaseModel, Field, TypeAdapter, create_model # type: ignore
from pydantic_core import PydanticUndefined
from typing_extensions import Literal

from ._pydantic_compat import model_dump, type2schema

logger = getLogger(__name__)

T = TypeVar("T")
Expand Down Expand Up @@ -141,7 +139,7 @@ def get_parameter_json_schema(k: str, v: Any, default_values: Dict[str, Any]) ->
A Pydanitc model for the parameter
"""

schema = type2schema(v)
schema = TypeAdapter(v).json_schema()
if k in default_values:
dv = default_values[k]
schema["default"] = dv
Expand Down Expand Up @@ -293,7 +291,7 @@ def f(
)
)

return model_dump(function)
return function.model_dump()


def normalize_annotated_type(type_hint: Type[Any]) -> Type[Any]:
Expand Down
50 changes: 0 additions & 50 deletions python/packages/autogen-core/src/autogen_core/_pydantic_compat.py

This file was deleted.

0 comments on commit ad7433e

Please sign in to comment.