Skip to content

fix: add missing default=None to modelinfo field in ShowResponse#665

Open
Abzaek wants to merge 1 commit into
ollama:mainfrom
Abzaek:fix/modelinfo-missing-default
Open

fix: add missing default=None to modelinfo field in ShowResponse#665
Abzaek wants to merge 1 commit into
ollama:mainfrom
Abzaek:fix/modelinfo-missing-default

Conversation

@Abzaek
Copy link
Copy Markdown

@Abzaek Abzaek commented May 16, 2026

Problem

modelinfo was declared Optional[Mapping[str, Any]] but the Field() call had no default argument:

modelinfo: Optional[Mapping[str, Any]] = Field(alias="model_info")

In Pydantic v2, Optional alone does not provide a default — the field is required. If an Ollama server response omits model_info (e.g. older server versions), Pydantic raises ValidationError.

Every other Optional field in ShowResponse explicitly sets = None.

Fix

Add default=None to the Field call.

modelinfo was declared Optional but Field() had no default,
making it a required field. If the server response omits
model_info, Pydantic raises ValidationError. This breaks
compatibility with older Ollama servers that don't return
model_info.
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.

1 participant