[GH-ISSUE #10937] JSON format schema ignored on /v1/ endpoint #7200

Closed
opened 2026-04-12 19:11:51 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ponychicken on GitHub (Jun 1, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10937

What is the issue?

What is the issue?

The JSON schema , or at least the "format": "date-time" does not work on the v1 endpoint.

Reproduction Steps

curl http://localhost:11434/v1/chat/completions -d '{
  "model": "gemma3:1b", 
  "messages": [
    {
      "role": "user",
      "content": "Here is some event info: The meeting is scheduled for Thursday (20th October 2025) afternoon. Please provide a JSON object with the event name and the date (human readable) of the meeting."
    }
  ],
  "response_format": {
    "type": "json_object",
    "schema": {
      "type": "object",
      "properties": {
        "event": { "type": "string" },
        "date": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": ["event", "date"]
    }
  },
  "stream": false
}'

Actual Output

{"event_name": "Meeting", "date": "20th October 2025"}

Expected Output

{"event": "Meeting", "date": "2025-10-20T14:00:00Z"}

Environment

  • Ollama API endpoint
  • Model: gemma3:4b
  • Date: 2025-06-01

Notes

I am not prompting the model to output ISO to make the bug more apparent. It also happens when asking for ISO strings but less often.

Relevant log output

No relevant output.

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.9.0

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @ponychicken on GitHub (Jun 1, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10937 ### What is the issue? ### What is the issue? The JSON schema , or at least the "format": "date-time" does not work on the v1 endpoint. ## Reproduction Steps ```bash curl http://localhost:11434/v1/chat/completions -d '{ "model": "gemma3:1b", "messages": [ { "role": "user", "content": "Here is some event info: The meeting is scheduled for Thursday (20th October 2025) afternoon. Please provide a JSON object with the event name and the date (human readable) of the meeting." } ], "response_format": { "type": "json_object", "schema": { "type": "object", "properties": { "event": { "type": "string" }, "date": { "type": "string", "format": "date-time" } }, "required": ["event", "date"] } }, "stream": false }' ``` ## Actual Output ```json {"event_name": "Meeting", "date": "20th October 2025"} ``` ## Expected Output ```json {"event": "Meeting", "date": "2025-10-20T14:00:00Z"} ``` ## Environment - Ollama API endpoint - Model: gemma3:4b - Date: 2025-06-01 ## Notes I am not prompting the model to output ISO to make the bug more apparent. It also happens when asking for ISO strings but less often. ### Relevant log output ```shell No relevant output. ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.9.0 ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 19:11:51 -05:00
Author
Owner

@mlaihk commented on GitHub (Jun 2, 2025):

I also noticed that non-native tool calling LLMs are working a lot worse in open webui in terms of invoking tools. This is probably why.....

<!-- gh-comment-id:2928173417 --> @mlaihk commented on GitHub (Jun 2, 2025): I also noticed that non-native tool calling LLMs are working a lot worse in open webui in terms of invoking tools. This is probably why.....
Author
Owner

@rick-github commented on GitHub (Jun 3, 2025):

--- ./10937.sh.orig	2025-06-03 03:10:32.272624315 +0200
+++ ./10937.sh	2025-06-03 03:10:15.537367732 +0200
@@ -9,17 +9,18 @@
     }
   ],
   "response_format": {
-    "type": "json_object",
-    "schema": {
-      "type": "object",
-      "properties": {
-        "event": { "type": "string" },
-        "date": {
-          "type": "string",
-          "format": "date-time"
-        }
-      },
-      "required": ["event", "date"]
+    "type": "json_schema",
+    "json_schema": {
+      "schema": {
+        "properties": {
+          "event": { "type": "string" },
+          "date": {
+            "type": "string",
+            "format": "date-time"
+          }
+        },
+        "required": ["event", "date"]
+      }
     }
   },
   "stream": false
$ ./10937.sh | jq -r '.choices[].message.content'
{"event": "Meeting", "date": "2025-10-20T14:00:00Z"}
<!-- gh-comment-id:2933032200 --> @rick-github commented on GitHub (Jun 3, 2025): ```diff --- ./10937.sh.orig 2025-06-03 03:10:32.272624315 +0200 +++ ./10937.sh 2025-06-03 03:10:15.537367732 +0200 @@ -9,17 +9,18 @@ } ], "response_format": { - "type": "json_object", - "schema": { - "type": "object", - "properties": { - "event": { "type": "string" }, - "date": { - "type": "string", - "format": "date-time" - } - }, - "required": ["event", "date"] + "type": "json_schema", + "json_schema": { + "schema": { + "properties": { + "event": { "type": "string" }, + "date": { + "type": "string", + "format": "date-time" + } + }, + "required": ["event", "date"] + } } }, "stream": false ``` ```console $ ./10937.sh | jq -r '.choices[].message.content' {"event": "Meeting", "date": "2025-10-20T14:00:00Z"} ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#7200