Skip to content

Tool-result images go after ALL of a reply's tool results - #27

Merged
ayman3000 merged 1 commit into
mainfrom
tool-images-after-all-results
Oct 14, 2026
Merged

ayman3000 merged 1 commit into
mainfrom
tool-images-after-all-results

Conversation

@ayman3000

Copy link
Copy Markdown
Owner

Two image-bearing tool calls in one reply used to come out as tool A, user(img A), tool B, user(img B) — a user message between a reply's tool results, which strict OpenAI-style wires reject (all of a reply's tool results must follow it directly).

Now each run of tool results stays together, followed by one user message with all the images in call order. A single image keeps the old caption.

  • Used by the OpenAI chat and Ollama encoders here, and by Naseem's Responses wire (OpenAI API + ChatGPT subscription).
  • Measured on Ollama Cloud: both orders accepted; gemma4 read both images correctly with either. The new order is the one every wire allows.
  • Tests: parallelToolImagesFollowAllResults, toolResultsWithoutImagesPassThrough; 187 pass.

🤖 Generated with Claude Code

expandingToolImagesToUserMessages put each image's user message right
after its own tool result, so two image-bearing calls in one reply came
out tool A, user(img A), tool B, user(img B) — a user message wedged
between a reply's tool results, which strict wires reject. Now each run
of tool results stays together and ONE user message with all images, in
call order, follows it. A single image keeps the old caption.

Used by the OpenAI chat, Ollama, and (via Naseem) Responses encoders.
Both orders measured accepted on Ollama Cloud (gemma4 read both images
correctly either way); the new order is the one every wire allows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ayman3000
ayman3000 merged commit aaf403b into main Oct 14, 2026
1 check passed
@ayman3000
ayman3000 deleted the tool-images-after-all-results branch October 14, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant