Skip to content

fix: resolve pydantic deprecation warnings #1317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

emmanuel-ferdman
Copy link
Contributor

PR Summary

This PR resolves the deprecation warnings of the Pydantic library, which you can find in the CI logs:

PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
    "generate_kwargs": GenerateKwargs().dict(),

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
Copy link

Title

Resolve Pydantic deprecation warnings by replacing dict() with model_dump()


Description

  • Replace dict() with model_dump() in Pydantic models

  • Resolve deprecation warnings related to Pydantic V2 migration


Changes walkthrough 📝

Relevant files
Bug fix
inference_api.py
Replace `dict()` with `model_dump()` in Pydantic models   

presets/workspace/inference/text-generation/inference_api.py

  • Updated messages_to_dict_list method to use model_dump()
  • Replaced GenerateKwargs().dict() with GenerateKwargs().model_dump() in
    example payloads
  • Updated generate_text function to use model_dump() for generate_kwargs
  • +4/-4     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Issue

    Ensure that the model_dump() method does not introduce any unintended side effects compared to the deprecated dict() method, especially regarding default values and data types.

    return [message.model_dump() for message in self.messages] if self.messages else []
    Possible Issue

    Verify that the model_dump() method does not introduce any unintended side effects compared to the deprecated dict() method, especially regarding default values and data types.

    "generate_kwargs": GenerateKwargs().model_dump(),
    Possible Issue

    Verify that the model_dump() method does not introduce any unintended side effects compared to the deprecated dict() method, especially regarding default values and data types.

    "generate_kwargs": GenerateKwargs().model_dump(),

    Copy link
    Collaborator

    @zhuangqh zhuangqh left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Thanks for you contribution. It really helps.

    @zhuangqh zhuangqh merged commit 06f4cbd into kaito-project:main Jul 29, 2025
    14 of 16 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Status: Done
    Development

    Successfully merging this pull request may close these issues.

    3 participants