[PR #15406] [MERGED] responses: add support for fn call output arrays #46389

Closed
opened 2026-04-25 01:50:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15406
Author: @drifkin
Created: 4/7/2026
Status: Merged
Merged: 4/7/2026
Merged by: @drifkin

Base: mainHead: drifkin/responses-tool-call-output-array


📝 Commits (1)

  • cbcc013 responses: add support for fn call output arrays

📊 Changes

2 files changed (+246 additions, -37 deletions)

View changed files

📝 openai/responses.go (+140 -37)
📝 openai/responses_test.go (+106 -0)

📄 Description

In addition to strings (which we already supported), OpenResponses supports arrays of text content, image content, or file content (see https://www.openresponses.org/reference#object-FunctionCallOutput-title). We were missing support for these arrays, which caused unmarshal errors like

json: cannot unmarshal array into Go struct field ResponsesFunctionCallOutput.output of type string

This change adds support for text content and image content, as those are more straightforwardly mappable to Ollama message formats (though image and text interleaving is lost), but it's less clear what to do for files. In the future we can partially support this by inlining reasonably sized text files, but wanted to get this change out first.

Fixes: #15250


🔄 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/15406 **Author:** [@drifkin](https://github.com/drifkin) **Created:** 4/7/2026 **Status:** ✅ Merged **Merged:** 4/7/2026 **Merged by:** [@drifkin](https://github.com/drifkin) **Base:** `main` ← **Head:** `drifkin/responses-tool-call-output-array` --- ### 📝 Commits (1) - [`cbcc013`](https://github.com/ollama/ollama/commit/cbcc013894ad5f30c9adeaf774bf6dc564e03e59) responses: add support for fn call output arrays ### 📊 Changes **2 files changed** (+246 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `openai/responses.go` (+140 -37) 📝 `openai/responses_test.go` (+106 -0) </details> ### 📄 Description In addition to strings (which we already supported), OpenResponses supports arrays of text content, image content, or file content (see <https://www.openresponses.org/reference#object-FunctionCallOutput-title>). We were missing support for these arrays, which caused unmarshal errors like ``` json: cannot unmarshal array into Go struct field ResponsesFunctionCallOutput.output of type string ``` This change adds support for text content and image content, as those are more straightforwardly mappable to Ollama message formats (though image and text interleaving is lost), but it's less clear what to do for files. In the future we can partially support this by inlining reasonably sized text files, but wanted to get this change out first. Fixes: #15250 --- <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-25 01:50:03 -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#46389