crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Deprecation Warnings for Pydantic V1 Usage

Open Maralai opened this issue 1 year ago • 1 comments

When using crewAI, I'm encountering deprecation warnings related to Pydantic V1 usage. These warnings suggest that the library is using some deprecated Pydantic V1 features that will be removed in Pydantic V3.0.

Warnings

  1. Support for class-based config is deprecated:
PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/

This warning appears to be coming from crewai/task.py.

  1. Pydantic V1 style @validator is deprecated:
PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.8/migration/

This warning appears to be coming from crewai_tools/tools/base_tool.py.

Suggested Action

It would be beneficial to update the codebase to use Pydantic V2 features instead of the deprecated V1 features. This will ensure compatibility with future versions of Pydantic and remove these deprecation warnings.

Additional Information

crewai version: 0.35.8

Though this is not recommended, we can ignore these specific warnings with the following code:

import warnings
from pydantic import PydanticDeprecatedSince20
warnings.filterwarnings("ignore", category=PydanticDeprecatedSince20)
warnings.filterwarnings("ignore", message="Pydantic V1 style `@validator` validators are deprecated")

Maralai avatar Jul 04 '24 09:07 Maralai

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 08 '24 14:08 github-actions[bot]

I'm using crewai v0.74.2 (with Python 3.12.7) and I'm seeing the same warnings.

davisjs avatar Oct 26 '24 04:10 davisjs

This issue has been fixed, please upgrade to latest version

theCyberTech avatar Dec 17 '24 06:12 theCyberTech