[GH-ISSUE #10936] JSON format schema ignored on /v1/ endpoint #69258

Closed
opened 2026-05-04 17:36:00 -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/10936

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

Originally created by @ponychicken on GitHub (Jun 1, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10936 ### 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
GiteaMirror added the bug label 2026-05-04 17:36:00 -05:00
Author
Owner

@ponychicken commented on GitHub (Jun 1, 2025):

In llama.cpp it works:

curl http://localhost:8080/v1/chat/completions -d '{
  "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
}'
{"choices":[{"finish_reason":"stop","index":0,"message":{"role":"assistant","content":"{\"event\": \"Meeting\", \"date\": \"2025-10-20T14:00:00Z\"}\n"}}],"created":1748783347,"model":"gpt-3.5-turbo","system_fingerprint":"b5540-291f2b69","object":"chat.completion","usage":{"completion_tokens":33,"prompt_tokens":54,"total_tokens":87},"id":"chatcmpl-k7OQTcnX3Wfmea2XaFjcBkcM5fDUYVZ4","timings":{"prompt_n":1,"prompt_ms":56.659,"prompt_per_token_ms":56.659,"prompt_per_second":17.649446689846275,"predicted_n":33,"predicted_ms":879.028,"predicted_per_token_ms":26.637212121212123,"predicted_per_second":37.54146625590994}}
<!-- gh-comment-id:2927210939 --> @ponychicken commented on GitHub (Jun 1, 2025): In llama.cpp it works: ``` curl http://localhost:8080/v1/chat/completions -d '{ "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 }' {"choices":[{"finish_reason":"stop","index":0,"message":{"role":"assistant","content":"{\"event\": \"Meeting\", \"date\": \"2025-10-20T14:00:00Z\"}\n"}}],"created":1748783347,"model":"gpt-3.5-turbo","system_fingerprint":"b5540-291f2b69","object":"chat.completion","usage":{"completion_tokens":33,"prompt_tokens":54,"total_tokens":87},"id":"chatcmpl-k7OQTcnX3Wfmea2XaFjcBkcM5fDUYVZ4","timings":{"prompt_n":1,"prompt_ms":56.659,"prompt_per_token_ms":56.659,"prompt_per_second":17.649446689846275,"predicted_n":33,"predicted_ms":879.028,"predicted_per_token_ms":26.637212121212123,"predicted_per_second":37.54146625590994}} ```
Author
Owner

@ponychicken commented on GitHub (Jun 1, 2025):

User error

<!-- gh-comment-id:2927222318 --> @ponychicken commented on GitHub (Jun 1, 2025): User error
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69258