Skip to content

[Bug]: Collection.get_model_fields emits warnings for Pydantic 2.11 #4190

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

Open
pmeier opened this issue Apr 7, 2025 · 1 comment · May be fixed by #4191
Open

[Bug]: Collection.get_model_fields emits warnings for Pydantic 2.11 #4190

pmeier opened this issue Apr 7, 2025 · 1 comment · May be fixed by #4191
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@pmeier
Copy link

pmeier commented Apr 7, 2025

What happened?

Starting with Pydantic 2.11 released a little over a week ago, accessing pydantic.BaseModel().model_fields on the instance results in deprecation warnings:

import warnings

warnings.simplefilter("always")

import chromadb

chroma_client = chromadb.Client()
collection = chroma_client.get_or_create_collection(name="my_collection")
/home/philip/miniforge3/envs/ragna-dev/lib/python3.10/site-packages/chromadb/types.py:144: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
  return self.model_fields  # pydantic 2.x
/home/philip/miniforge3/envs/ragna-dev/lib/python3.10/site-packages/chromadb/types.py:144: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
  return self.model_fields  # pydantic 2.x
/home/philip/miniforge3/envs/ragna-dev/lib/python3.10/site-packages/chromadb/types.py:144: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
  return self.model_fields  # pydantic 2.x
/home/philip/miniforge3/envs/ragna-dev/lib/python3.10/site-packages/chromadb/types.py:144: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
  return self.model_fields  # pydantic 2.x

Versions

Chroma 1.0.0, pydantic 2.11

Relevant log output

@pmeier pmeier added the bug Something isn't working label Apr 7, 2025
@jeffchuber jeffchuber added the good first issue Good for newcomers label Apr 15, 2025
@jeffchuber jeffchuber assigned jeffchuber and jairad26 and unassigned jeffchuber Apr 15, 2025
@jairad26
Copy link
Contributor

jairad26 commented Apr 22, 2025

handling this as part of a type safety PR here
#4339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants