Skip to content

fix(configs): migrate CassandraConfig and AzureMySQLConfig to pydantic v2 ConfigDict#4646

Merged
kartik-mem0 merged 1 commit intomem0ai:mainfrom
Prithvi1994:fix/pydantic-v2-config-cassandra-azure-mysql
Apr 1, 2026
Merged

fix(configs): migrate CassandraConfig and AzureMySQLConfig to pydantic v2 ConfigDict#4646
kartik-mem0 merged 1 commit intomem0ai:mainfrom
Prithvi1994:fix/pydantic-v2-config-cassandra-azure-mysql

Conversation

@Prithvi1994
Copy link
Copy Markdown
Contributor

Summary

CassandraConfig and AzureMySQLConfig were the only two vector store config classes still using the pydantic v1 inner class Config: pattern. Every other config in mem0/configs/vector_stores/ (qdrant, chroma, milvus, pinecone, redis, weaviate, etc.) already uses the pydantic v2 model_config = ConfigDict(...) style.

Changes

  • mem0/configs/vector_stores/cassandra.py: replace class Config: arbitrary_types_allowed = True with model_config = ConfigDict(arbitrary_types_allowed=True), add ConfigDict to imports
  • mem0/configs/vector_stores/azure_mysql.py: same change

Why

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 = True and ConfigDict(arbitrary_types_allowed=True) are functionally identical — this is purely a consistency and forward-compatibility fix.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

…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.
@Prithvi1994 Prithvi1994 force-pushed the fix/pydantic-v2-config-cassandra-azure-mysql branch from d3bcfb9 to 70dcb70 Compare April 1, 2026 08:42
@kartik-mem0 kartik-mem0 merged commit f94ea06 into mem0ai:main Apr 1, 2026
6 of 7 checks passed
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
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.

3 participants