[GH-ISSUE #4428] Ollama Api not working after adding format:"json" #2766

Closed
opened 2026-04-12 13:05:15 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @usmandilmeer on GitHub (May 14, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4428

What is the issue?

Ollama api is giving empty response if i add add format as json
image

OS

Windows

GPU

AMD

CPU

Intel

Ollama version

0.1.37

Originally created by @usmandilmeer on GitHub (May 14, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4428 ### What is the issue? Ollama api is giving empty response if i add add format as json ![image](https://github.com/ollama/ollama/assets/51738693/31636d22-30bf-4c9f-9a1f-7ac6cc1a33ef) ### OS Windows ### GPU AMD ### CPU Intel ### Ollama version 0.1.37
GiteaMirror added the bugamdwindows labels 2026-04-12 13:05:15 -05:00
Author
Owner

@thinkverse commented on GitHub (May 14, 2024):

The issue is reproducible on MacOS and Ollama 0.1.37 as well. It's not a Windows-specific issue. It has more to do with not passing a system prompt telling the LLM to respond with JSON.

Screenshot 2024-05-14 at 20 23 35

Ollama does warn about that but it's not returned as a warning in the API response, it's in the logs1 .

Screenshot 2024-05-14 at 20 34 35

@usmandilmeer could you try setting a system response and trying again to see if the issue still happens?

<!-- gh-comment-id:2110871780 --> @thinkverse commented on GitHub (May 14, 2024): The issue is reproducible on MacOS and Ollama 0.1.37 as well. It's not a Windows-specific issue. It has more to do with not passing a system prompt telling the LLM to respond with JSON. <img width="867" alt="Screenshot 2024-05-14 at 20 23 35" src="https://github.com/ollama/ollama/assets/2221746/7dbc52e2-9b5a-4bed-9b1a-1d944589e1c2"> Ollama does warn about that but it's not returned as a warning in the API response, it's in the logs[^1]. <img width="1003" alt="Screenshot 2024-05-14 at 20 34 35" src="https://github.com/ollama/ollama/assets/2221746/d4c3858f-6559-4469-99f5-0d59933c9c09"> @usmandilmeer could you try setting a system response and trying again to see if the issue still happens? [^1]: https://github.com/ollama/ollama/blob/798b107f19ed832d33a6816f11363b42888aaed3/llm/server.go#L656
Author
Owner

@usmandilmeer commented on GitHub (May 14, 2024):

Thanks, now it is working.

<!-- gh-comment-id:2111191467 --> @usmandilmeer commented on GitHub (May 14, 2024): Thanks, now it is working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2766