[PR #8016] [CLOSED] Add warning message when prompt doesn't include json for structured outputs #23128

Closed
opened 2026-04-19 16:47:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8016
Author: @danclaytondev
Created: 12/9/2024
Status: Closed

Base: mainHead: fix/warning-structured-outputs-prompt


📝 Commits (1)

  • bf89efe server: add warning message when prompt doesn't include json for structured outputs

📊 Changes

1 file changed (+9 additions, -2 deletions)

View changed files

📝 llm/server.go (+9 -2)

📄 Description

ollama currently warns when json output is required but it is not mentioned in the prompt. It is recommended in the docs that prompts should ask for JSON output.

With the new structured output feature, the warning isn't logged if a user supplied a schema, only if they ask for "format": "json". I think we need the warning in both cases.

Tagging @ParthSareen because I think you have been working on this recently. :)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/8016 **Author:** [@danclaytondev](https://github.com/danclaytondev) **Created:** 12/9/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/warning-structured-outputs-prompt` --- ### 📝 Commits (1) - [`bf89efe`](https://github.com/ollama/ollama/commit/bf89efeb0067dbcd597e3882fcc34d35ebf58af1) server: add warning message when prompt doesn't include json for structured outputs ### 📊 Changes **1 file changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `llm/server.go` (+9 -2) </details> ### 📄 Description ollama currently warns when `json` output is required but it is not mentioned in the prompt. It is recommended in the docs that prompts should ask for JSON output. With the new structured output feature, the warning isn't logged if a user supplied a schema, only if they ask for `"format": "json"`. I think we need the warning in both cases. Tagging @ParthSareen because I think you have been working on this recently. :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 16:47:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#23128