crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
19.11k stars 2.64k forks source link

Deprecation Warnings for Pydantic V1 Usage #866

Open Maralai opened 2 months ago

Maralai commented 2 months ago

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")
github-actions[bot] commented 1 month ago

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.