[PR #10649] [MERGED] grammar: allocate buffer based on schema length #23852

Closed
opened 2026-04-19 17:15:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10649
Author: @rick-github
Created: 5/10/2025
Status: Merged
Merged: 5/10/2025
Merged by: @jmorganca

Base: mainHead: grammar-length


📝 Commits (2)

  • bb0d1b9 grammar: allocate buffer based on schema length
  • 89bd67a set a more reasonable upper bound

📊 Changes

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

View changed files

📝 llama/llama.go (+2 -2)

📄 Description

Structured outputs for applications that do NER can generate grammars that exceed the static buffer allocated in SchemaToGrammar(). Instead, allocate the buffer based on the length of the schema.

Fixes: #10646


🔄 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/10649 **Author:** [@rick-github](https://github.com/rick-github) **Created:** 5/10/2025 **Status:** ✅ Merged **Merged:** 5/10/2025 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `grammar-length` --- ### 📝 Commits (2) - [`bb0d1b9`](https://github.com/ollama/ollama/commit/bb0d1b97f6f4884be1938db1e40d5a10640e97a9) grammar: allocate buffer based on schema length - [`89bd67a`](https://github.com/ollama/ollama/commit/89bd67a02894d5d57a0c3daf1bf812c61bf757fd) set a more reasonable upper bound ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `llama/llama.go` (+2 -2) </details> ### 📄 Description Structured outputs for applications that do NER can generate grammars that exceed the static buffer allocated in SchemaToGrammar(). Instead, allocate the buffer based on the length of the schema. Fixes: #10646 --- <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 17:15:20 -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#23852