diff --git a/src/cohere/core/pydantic_utilities.py b/src/cohere/core/pydantic_utilities.py index 0f24b0ea8..f02a5e0e4 100644 --- a/src/cohere/core/pydantic_utilities.py +++ b/src/cohere/core/pydantic_utilities.py @@ -84,9 +84,11 @@ def to_jsonable_with_fallback( class UniversalBaseModel(pydantic.BaseModel): class Config: - populate_by_name = True - smart_union = True - allow_population_by_field_name = True + if IS_PYDANTIC_V2: + populate_by_name = True + else: + smart_union = True + allow_population_by_field_name = True json_encoders = {dt.datetime: serialize_datetime} def json(self, **kwargs: typing.Any) -> str: