fix(configs): migrate CassandraConfig and AzureMySQLConfig to pydantic v2 ConfigDict#4646
Merged
kartik-mem0 merged 1 commit intomem0ai:mainfrom Apr 1, 2026
Conversation
…c v2 ConfigDict CassandraConfig and AzureMySQLConfig were the only two vector store config classes still using the pydantic v1 `class Config:` inner class pattern. All other config classes (qdrant, chroma, milvus, pinecone, redis, etc.) already use the pydantic v2 `model_config = ConfigDict(...)` style. Changes: - Replace `class Config: arbitrary_types_allowed = True` with `model_config = ConfigDict(arbitrary_types_allowed=True)` in both files - Add `ConfigDict` to the pydantic imports in both files No behaviour change — this is a consistency fix to align with the rest of the codebase and silence pydantic v2 deprecation warnings.
d3bcfb9 to
70dcb70
Compare
kartik-mem0
approved these changes
Apr 1, 2026
Prithvi1994
added a commit
to Prithvi1994/mem0
that referenced
this pull request
Apr 1, 2026
Following up on mem0ai#4646, five more vector store config classes were missing `model_config = ConfigDict(arbitrary_types_allowed=True)` despite using pydantic v2 constructs (model_validator, Field). One config (neptune.py) used a raw dict instead of ConfigDict. One (valkey.py) had bare field annotations with no Field() descriptions or validate_extra_fields guard. Changes: - elasticsearch.py: add ConfigDict import + model_config (required: has Callable field type) - mongodb.py: add ConfigDict import + model_config - opensearch.py: add ConfigDict import + model_config (required: has Optional[object] and Optional[Type] fields) - pgvector.py: add ConfigDict import + model_config (required: has Optional[Any] connection_pool field) - supabase.py: add ConfigDict import + model_config - valkey.py: add ConfigDict import + model_config + Field descriptions + validate_extra_fields (was the only config with bare annotations and no extra-field guard, inconsistent with all peers) - neptune.py: replace raw dict `model_config = {...}` with `model_config = ConfigDict(...)` per pydantic v2 convention No behaviour change. All configs now consistently use ConfigDict.
rainfd
pushed a commit
to rainfd/mem0
that referenced
this pull request
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CassandraConfigandAzureMySQLConfigwere the only two vector store config classes still using the pydantic v1 innerclass Config:pattern. Every other config inmem0/configs/vector_stores/(qdrant, chroma, milvus, pinecone, redis, weaviate, etc.) already uses the pydantic v2model_config = ConfigDict(...)style.Changes
mem0/configs/vector_stores/cassandra.py: replaceclass Config: arbitrary_types_allowed = Truewithmodel_config = ConfigDict(arbitrary_types_allowed=True), addConfigDictto importsmem0/configs/vector_stores/azure_mysql.py: same changeWhy
Pydantic v2 emits a deprecation warning when the inner
class Config:pattern is used. This aligns these two files with the rest of the codebase and removes the inconsistency.No behaviour change
arbitrary_types_allowed = TrueandConfigDict(arbitrary_types_allowed=True)are functionally identical — this is purely a consistency and forward-compatibility fix.