[PR #15703] model/renderers/gemma4: allow reserved JSON Schema keys as parameter names #25759

Open
opened 2026-04-19 18:25:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15703
Author: @mverrilli
Created: 4/19/2026
Status: 🔄 Open

Base: mainHead: fix/issue-15670-gemma4-reserved-param-names


📝 Commits (1)

  • 62b82e7 model/renderers/gemma4: allow reserved JSON Schema keys as parameter names

📊 Changes

2 files changed (+36 additions, -4 deletions)

View changed files

📝 model/renderers/gemma4.go (+7 -4)
📝 model/renderers/gemma4_reference_test.go (+29 -0)

📄 Description

Problem

Any tool parameter named description, type, properties, required, or nullable is silently dropped from the rendered declaration sent to Gemma4 models. These are valid JSON Schema keywords but are also valid user-defined parameter names.

Root cause: writeSchemaProperties called isSchemaStandardKey() on parameter names, treating those strings as reserved. A tool with a description parameter would render properties:{propX:{...},propY:{...}} — the description property completely absent — while still listing it in required.

Fix

Remove the isSchemaStandardKey guard from the general property-name loop. The function is still applied in the one internal fallback path that passes a raw schema object (rather than a properties map) to writeSchemaProperties, where filtering out metadata keys is correct.

Test

Added reserved_schema_key_as_param_name to TestGemma4RendererMatchesReference. The test fails without the fix (reproduces the exact issue from the report) and passes with it. All 69 renderer tests pass.

Fixes #15670


🔄 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/15703 **Author:** [@mverrilli](https://github.com/mverrilli) **Created:** 4/19/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-15670-gemma4-reserved-param-names` --- ### 📝 Commits (1) - [`62b82e7`](https://github.com/ollama/ollama/commit/62b82e7f2d6f8c1b3fe776a1ccd43adf1389e8db) model/renderers/gemma4: allow reserved JSON Schema keys as parameter names ### 📊 Changes **2 files changed** (+36 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `model/renderers/gemma4.go` (+7 -4) 📝 `model/renderers/gemma4_reference_test.go` (+29 -0) </details> ### 📄 Description ## Problem Any tool parameter named `description`, `type`, `properties`, `required`, or `nullable` is silently dropped from the rendered declaration sent to Gemma4 models. These are valid JSON Schema keywords but are also valid user-defined parameter names. Root cause: `writeSchemaProperties` called `isSchemaStandardKey()` on parameter *names*, treating those strings as reserved. A tool with a `description` parameter would render `properties:{propX:{...},propY:{...}}` — the `description` property completely absent — while still listing it in `required`. ## Fix Remove the `isSchemaStandardKey` guard from the general property-name loop. The function is still applied in the one internal fallback path that passes a raw schema object (rather than a properties map) to `writeSchemaProperties`, where filtering out metadata keys is correct. ## Test Added `reserved_schema_key_as_param_name` to `TestGemma4RendererMatchesReference`. The test fails without the fix (reproduces the exact issue from the report) and passes with it. All 69 renderer tests pass. Fixes #15670 --- <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 18:25:55 -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#25759