[PR #3783] [CLOSED] Allow any kind of JSON including arrays or straight literals, not just objects #37149

Closed
opened 2026-04-22 21:51:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/3783
Author: @hughescr
Created: 4/20/2024
Status: Closed

Base: mainHead: feature/allow-any-json-at-top-level-not-just-objects


📝 Commits (1)

  • b33124a Allow any kind of JSON including arrays or straight literals, not just objects at the top level.

📊 Changes

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

View changed files

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

📄 Description

This is a simple PR which allows the format=json constraint to generate any valid JSON, not just JSON with an object at the top level. This allows models to generate arrays, strings, numbers, or literals without an object wrapper around them, reducing the number of tokens necessary for many use cases.

Remember that every token is more CO2 emitted into the atmosphere and more $$$ transferred from everyone's pockets into NVidia's treasure. Tokens matter!


🔄 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/3783 **Author:** [@hughescr](https://github.com/hughescr) **Created:** 4/20/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/allow-any-json-at-top-level-not-just-objects` --- ### 📝 Commits (1) - [`b33124a`](https://github.com/ollama/ollama/commit/b33124aad1d7d64c4cc227bc0753a0c46dac3af1) Allow any kind of JSON including arrays or straight literals, not just objects at the top level. ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `llm/server.go` (+1 -1) </details> ### 📄 Description This is a simple PR which allows the `format=json` constraint to generate any valid JSON, not just JSON with an object at the top level. This allows models to generate arrays, strings, numbers, or literals without an object wrapper around them, reducing the number of tokens necessary for many use cases. Remember that every token is more CO2 emitted into the atmosphere and more $$$ transferred from everyone's pockets into NVidia's treasure. Tokens matter! --- <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-22 21:51:49 -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#37149