Ollama structured outputs not working on Windows #8338
Closed
Description
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