[GH-ISSUE #8338] Ollama structured outputs not working on Windows #83030

Closed
opened 2026-05-09 16:58:18 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @mansibm6 on GitHub (Jan 7, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8338

Originally assigned to: @ParthSareen on GitHub.

Any workaround for this issue on Windows?

"""from ollama import chat
from pydantic import BaseModel

class Country(BaseModel):
name: str
capital: str
languages: list[str]

response = chat(
messages=[
{
'role': 'user',
'content': 'Tell me about Canada.',
}
],
model='llama3.1',
format=Country.model_json_schema(),
)

country = Country.model_validate_json(response.message.content)
print(country)"""

This is the example given by Ollama for using their structured ouptuts feature. This works for Mac doesn't work for Windows. All the dependencies are installed. Ollama is updated to the latest version. On Windows, it's giving me the error: 'dict' object has no attribute 'message.' But works fine on MacOS.

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.5.4

Originally created by @mansibm6 on GitHub (Jan 7, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8338 Originally assigned to: @ParthSareen on GitHub. ### Any workaround for this issue on Windows? """from ollama import chat from pydantic import BaseModel class Country(BaseModel): name: str capital: str languages: list[str] response = chat( messages=[ { 'role': 'user', 'content': 'Tell me about Canada.', } ], model='llama3.1', format=Country.model_json_schema(), ) country = Country.model_validate_json(response.message.content) print(country)""" This is the example given by Ollama for using their structured ouptuts feature. This works for Mac doesn't work for Windows. All the dependencies are installed. Ollama is updated to the latest version. On Windows, it's giving me the error: 'dict' object has no attribute 'message.' But works fine on MacOS. ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.5.4
GiteaMirror added the bug label 2026-05-09 16:58:18 -05:00
Author
Owner

@ParthSareen commented on GitHub (Jan 7, 2025):

Hey @mansibm6 can you grab the version of the python package? pip show ollama There is a chance there's a mismatch

<!-- gh-comment-id:2576223180 --> @ParthSareen commented on GitHub (Jan 7, 2025): Hey @mansibm6 can you grab the version of the python package? `pip show ollama` There is a chance there's a mismatch
Author
Owner

@mansibm6 commented on GitHub (Jan 8, 2025):

Hey @mansibm6 can you grab the version of the python package? pip show ollama There is a chance there's a mismatch

Thanks for reaching out. Here's the version you requested:
Name: ollama
Version: 0.3.3
Summary: The official Python client for Ollama.
Home-page: https://ollama.ai
Author: Ollama
Author-email: hello@ollama.com
License: MIT
Location: C:\Users\mmursali\AppData\Roaming\Python\Python313\site-packages
Requires: httpx
Required-by:

<!-- gh-comment-id:2578833825 --> @mansibm6 commented on GitHub (Jan 8, 2025): > Hey @mansibm6 can you grab the version of the python package? `pip show ollama` There is a chance there's a mismatch Thanks for reaching out. Here's the version you requested: Name: ollama Version: 0.3.3 Summary: The official Python client for Ollama. Home-page: https://ollama.ai Author: Ollama Author-email: hello@ollama.com License: MIT Location: C:\Users\mmursali\AppData\Roaming\Python\Python313\site-packages Requires: httpx Required-by:
Author
Owner

@ParthSareen commented on GitHub (Jan 8, 2025):

@mansibm6 got it. We're on 0.4.5 now - https://github.com/ollama/ollama-python/releases/tag/v0.4.5

pip install -U ollama

<!-- gh-comment-id:2578835783 --> @ParthSareen commented on GitHub (Jan 8, 2025): @mansibm6 got it. We're on 0.4.5 now - https://github.com/ollama/ollama-python/releases/tag/v0.4.5 `pip install -U ollama`
Author
Owner

@mansibm6 commented on GitHub (Jan 8, 2025):

@mansibm6 got it. We're on 0.4.5 now - https://github.com/ollama/ollama-python/releases/tag/v0.4.5

pip install -U ollama

Thanks! Issue resolved!

<!-- gh-comment-id:2578843164 --> @mansibm6 commented on GitHub (Jan 8, 2025): > @mansibm6 got it. We're on 0.4.5 now - https://github.com/ollama/ollama-python/releases/tag/v0.4.5 > > `pip install -U ollama` Thanks! Issue resolved!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#83030