Skip to content

fix: Use ConfigDict instead of class-based Config#3409

Merged
parshvadaftari merged 2 commits intomem0ai:mainfrom
gabe-l-hart:PydanticDeperecation-3408
Sep 4, 2025
Merged

fix: Use ConfigDict instead of class-based Config#3409
parshvadaftari merged 2 commits intomem0ai:mainfrom
gabe-l-hart:PydanticDeperecation-3408

Conversation

@gabe-l-hart
Copy link
Copy Markdown
Contributor

Description

This updates the openmemory.api.app.schemas.Memory and mem0.client.project.ProjectConfig pydantic classes to use the modern ConfigDict style rather than class Config:.

Fixes #3408

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Before

?> uv run python -Wd -c "import mem0"
# .venv/lib/python3.12/site-packages/pydantic/_internal/_config.py:323: 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.11/migration/
  warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)

After

?> uv run python -Wd -c "import mem0"
# no warning

NOTE: Since this is a small patch, I didn't get the full dev environment off the ground (I'm not normally a hatch user). If CI fails, I'm happy to put in the extra minutes to get it clean locally.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

Closes: mem0ai#3408
Branch: PydanticDeperecation-3408

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Sep 3, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@parshvadaftari parshvadaftari left a comment

Choose a reason for hiding this comment

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

Please incorporate the requested changes.

import httpx
from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you update the class Config to ConfigDict everywhere. There are few other files as well. Thanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah! I just did a simple grep, sorry I missed those. I'll look further

@gabe-l-hart
Copy link
Copy Markdown
Contributor Author

Hm, it looks like the embedchain CI is failing because it's not finding the poetry executable which shouldn't be related to this PR.

@parshvadaftari
Copy link
Copy Markdown
Contributor

@gabe-l-hart you can remove the changes in the embedchain. Keep for the mem0ai and openmemory only.

This consolidates the two old ways of setting the pydantic model config
(class-based and raw dict) into the official ConfigDict method.

mem0ai#3408
Branch: PydanticDeperecation-3408

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
@gabe-l-hart gabe-l-hart force-pushed the PydanticDeperecation-3408 branch from d9c8f00 to e2cefb8 Compare September 3, 2025 18:47
@gabe-l-hart
Copy link
Copy Markdown
Contributor Author

Ok, looks like everything besides the Vercel login is passing now

@parshvadaftari parshvadaftari merged commit b27879b into mem0ai:main Sep 4, 2025
6 of 7 checks passed
@parshvadaftari
Copy link
Copy Markdown
Contributor

@gabe-l-hart Thanks for the contribution!

@gabe-l-hart
Copy link
Copy Markdown
Contributor Author

Thanks for the review!

@gabe-l-hart gabe-l-hart deleted the PydanticDeperecation-3408 branch September 4, 2025 15:04
turtlebasket referenced this pull request in turtlebasket/mem0x Sep 5, 2025
Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
(cherry picked from commit b27879b)
thestumonkey pushed a commit to Ushadow-io/mem0 that referenced this pull request Sep 7, 2025
Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug (deprecation): pydantic Support for class-based config is deprecated, use ConfigDict instead

3 participants