ollama-python icon indicating copy to clipboard operation
ollama-python copied to clipboard

`PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated.`

Open khteh opened this issue 8 months ago • 6 comments

My terminal is innundated with these warnings:

/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:81: 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.
  if key in self.model_fields:
/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:82: 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[key].default is not None
/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:81: 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.
  if key in self.model_fields:
/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:82: 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[key].default is not None
/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:81: 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.
  if key in self.model_fields:
/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.13/site-packages/ollama/_types.py:82: 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[key].default is not None

khteh avatar Apr 23 '25 10:04 khteh

How do I filter out this warning from being logged?

khteh avatar Apr 24 '25 08:04 khteh

Hey @khteh will check this out - is this happening with any request?

ParthSareen avatar Apr 24 '25 17:04 ParthSareen

It happens at rest

khteh avatar Apr 25 '25 01:04 khteh

Sorry, it happens when serving requests and every request. When can this be fixed?

khteh avatar May 27 '25 05:05 khteh

How do I filter out this warning from being logged?

you can try warnings.filterwarnings("ignore", category=DeprecationWarning, module="ollama")

jonigl avatar May 30 '25 14:05 jonigl

Is this fixed? I don't see the warnings in the console anymore after updating my pipenv dependencies..?

khteh avatar Jun 04 '25 05:06 khteh