Skip to content

Pydantic V2 Deprecation Warnings in fireworks-ai Python SDK #138

@nbarbier-amira

Description

@nbarbier-amira

Issue Description

The fireworks-ai Python SDK is generating multiple Pydantic V2 deprecation warnings when used with modern Python environments and testing frameworks. These warnings indicate the SDK is using deprecated Pydantic V1 patterns that will be removed in Pydantic V3.

Deprecation Warnings Observed

1. Image API Validators (Lines 131, 139)

/path/to/site-packages/fireworks/client/image_api.py:131: 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.
    @validator("image_strength", pre=True, always=True)

/path/to/site-packages/fireworks/client/image_api.py:139: 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.
    @validator("step_schedule_start", "step_schedule_end", pre=True, always=True)

2. Control Plane Model Details (30+ warnings)

/path/to/site-packages/fireworks/control_plane/generated/protos/gateway/__init__.py:7789: 
DeprecationWarning: BaseModelDetails.tunable is deprecated
    warnings.warn("BaseModelDetails.tunable is deprecated", DeprecationWarning)

Environment

  • Python: 3.13.3
  • fireworks-ai: Latest version from PyPI
  • Pydantic: 2.x (modern version)
  • Testing Framework: pytest with warning reporting

Expected Behavior

The SDK should use modern Pydantic V2 patterns and not generate deprecation warnings.

Suggested Fixes

For Image API (image_api.py)

Replace deprecated @validator decorators with @field_validator:

# Instead of:
@validator("image_strength", pre=True, always=True)

# Use:
@field_validator("image_strength", mode="before")
@classmethod
def validate_image_strength(cls, v):
    # validation logic
    return v

For Control Plane Generated Code

Update the generated protobuf code to remove deprecated BaseModelDetails.tunable usage or suppress the warnings appropriately.

Impact

  • Development Experience: Clutters test output with 30+ deprecation warnings
  • Future Compatibility: Code will break when Pydantic V3 is released
  • Professional Usage: Makes it difficult to maintain clean CI/CD pipelines

Additional Context

This issue affects users running comprehensive test suites or applications with strict warning policies. While the warnings don't currently break functionality, they will become errors in future Pydantic versions.

References

Please consider prioritizing this fix to maintain compatibility with modern Python tooling and prepare for Pydantic V3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions