[PR #10131] [MERGED] server: improve spacing for JSON grammar #59848

Closed
opened 2026-04-29 14:46:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10131
Author: @ParthSareen
Created: 4/4/2025
Status: Merged
Merged: 4/24/2025
Merged by: @ParthSareen

Base: mainHead: parth/server-improve-json-grammar


📝 Commits (3)

  • a95f14f server: improve spacing for JSON grammar
  • aa01331 simplify changes
  • 569aeef remove initial whitespace + from object

📊 Changes

1 file changed (+5 additions, -5 deletions)

View changed files

📝 llm/server.go (+5 -5)

📄 Description

Pulled out from https://github.com/ollama/ollama/pull/10096 for improving whitespace in grammars

Fixing \n with grammar

New gemma output

❯ go run . run gemma3
# github.com/ollama/ollama
ld: warning: ignoring duplicate libraries: '-lobjc'
>>> /set format json
Set format to 'json' mode.
>>> create a json
        {
                "name": "Example JSON",
                "version":      "1.0",
                "description":  "A simple example JSON document.",
                "author":       "Bard",
                "date": "2023-10-27",
                "data": {
                        "numbers":      [1,     2,      3,      4,      5],
                        "strings":      ["apple",       "banana",       "cherry"],
                        "boolean":      true,
                        "null_value":   null,
                        "object":       {
                                "key1": "value1",
                                "key2": 123,
                                "key3": {
                                        "nested_key":   "nested_value"
                                }
                        }
                }
        }

Previous gemma output

❯ go run . run gemma3
# github.com/ollama/ollama
ld: warning: ignoring duplicate libraries: '-lobjc'
>>> /set format json
Set format to 'json' mode.
>>> create a json
{}

   
   
   
   
   
   
   
   
   
   
   
   
   
   

🔄 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/10131 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 4/4/2025 **Status:** ✅ Merged **Merged:** 4/24/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/server-improve-json-grammar` --- ### 📝 Commits (3) - [`a95f14f`](https://github.com/ollama/ollama/commit/a95f14f599c2e96eade6b9776c106fc21bb9802b) server: improve spacing for JSON grammar - [`aa01331`](https://github.com/ollama/ollama/commit/aa013317f8e9c5aaba3e3585a6e4732b8573e059) simplify changes - [`569aeef`](https://github.com/ollama/ollama/commit/569aeefef15bac8d015a8f256e7105942cbbe008) remove initial whitespace + from object ### 📊 Changes **1 file changed** (+5 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `llm/server.go` (+5 -5) </details> ### 📄 Description Pulled out from https://github.com/ollama/ollama/pull/10096 for improving whitespace in grammars ## Fixing `\n` with grammar New gemma output ``` ❯ go run . run gemma3 # github.com/ollama/ollama ld: warning: ignoring duplicate libraries: '-lobjc' >>> /set format json Set format to 'json' mode. >>> create a json { "name": "Example JSON", "version": "1.0", "description": "A simple example JSON document.", "author": "Bard", "date": "2023-10-27", "data": { "numbers": [1, 2, 3, 4, 5], "strings": ["apple", "banana", "cherry"], "boolean": true, "null_value": null, "object": { "key1": "value1", "key2": 123, "key3": { "nested_key": "nested_value" } } } } ``` Previous gemma output ``` ❯ go run . run gemma3 # github.com/ollama/ollama ld: warning: ignoring duplicate libraries: '-lobjc' >>> /set format json Set format to 'json' mode. >>> create a json {} ``` --- <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-29 14:46:28 -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#59848