[PR #12518] [CLOSED] WIP: stable ordering for tool args #60552

Closed
opened 2026-04-29 15:34:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12518
Author: @drifkin
Created: 10/7/2025
Status: Closed

Base: mainHead: drifkin/stable-tool-args


📝 Commits (1)

  • c87b910 WIP: stable ordering for tool args

📊 Changes

17 files changed (+936 additions, -348 deletions)

View changed files

📝 api/types.go (+200 -7)
📝 api/types_test.go (+45 -14)
📝 go.mod (+4 -0)
📝 go.sum (+9 -0)
📝 integration/api_test.go (+9 -5)
📝 middleware/openai_test.go (+30 -41)
📝 model/parsers/qwen3coder.go (+4 -4)
📝 model/parsers/qwen3coder_test.go (+34 -29)
📝 model/renderers/qwen3coder.go (+22 -20)
📝 model/renderers/qwen3coder_test.go (+101 -28)
📝 server/routes_generate_test.go (+43 -34)
📝 server/routes_harmony_streaming_test.go (+27 -26)
template/rewrite.go (+149 -0)
template/rewrite_test.go (+131 -0)
📝 template/template.go (+4 -0)
📝 tools/tools.go (+7 -2)
📝 tools/tools_test.go (+117 -138)

📄 Description

Right now we deserialize tool call definitions' arguments into golang maps. These purposefully don't have a predictable iteration order, whereas we want to maintain the order the user originally provided.

Unstable rendering of arguments means that we break the kv cache, which this change fixes.


🔄 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/12518 **Author:** [@drifkin](https://github.com/drifkin) **Created:** 10/7/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `drifkin/stable-tool-args` --- ### 📝 Commits (1) - [`c87b910`](https://github.com/ollama/ollama/commit/c87b910232c213df7f4f1729d1f3151a690a55be) WIP: stable ordering for tool args ### 📊 Changes **17 files changed** (+936 additions, -348 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+200 -7) 📝 `api/types_test.go` (+45 -14) 📝 `go.mod` (+4 -0) 📝 `go.sum` (+9 -0) 📝 `integration/api_test.go` (+9 -5) 📝 `middleware/openai_test.go` (+30 -41) 📝 `model/parsers/qwen3coder.go` (+4 -4) 📝 `model/parsers/qwen3coder_test.go` (+34 -29) 📝 `model/renderers/qwen3coder.go` (+22 -20) 📝 `model/renderers/qwen3coder_test.go` (+101 -28) 📝 `server/routes_generate_test.go` (+43 -34) 📝 `server/routes_harmony_streaming_test.go` (+27 -26) ➕ `template/rewrite.go` (+149 -0) ➕ `template/rewrite_test.go` (+131 -0) 📝 `template/template.go` (+4 -0) 📝 `tools/tools.go` (+7 -2) 📝 `tools/tools_test.go` (+117 -138) </details> ### 📄 Description Right now we deserialize tool call definitions' arguments into golang maps. These purposefully don't have a predictable iteration order, whereas we want to maintain the order the user originally provided. Unstable rendering of arguments means that we break the kv cache, which this change fixes. --- <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 15:34:45 -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#60552