Skip to content

feat(tools): read an image file as an attachment for a model that sees - #1599

Merged
edenreich merged 1 commit into
mainfrom
feat/read-attaches-images
Oct 21, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/read-attaches-images

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Read hands an image file to a vision model as an attachment the agent loop sends with the next message, instead of refusing every image. A text-only model, or a session without an image service, gets an error pointing at ImageDecode, which describes the image in words. A file without an extension that holds an image is sniffed and treated the same.

Seen in an OpenTask run where glm-5.3-flash, a vision model, had to go through ImageDecode for every screenshot it took, because Read turned image files away for every model.

Changes

  • internal/tools/read.go: an image file (by extension, or sniffed when it has none) is returned as an attachment when the gateway's modalities say the model takes images. Otherwise the error names ImageDecode. The sandbox path check runs first.
  • internal/tools/registry.go: Read gets the image service.
  • internal/tools/Read.yaml: the manifest says what happens with an image now.
  • internal/tools/read_test.go: a table test for a vision model, a sniffed image, a text model and a session without an image service.
  • internal/agent/loop/testdata/tool_definitions.golden.json: refreshed.

Verification

  • go test -race ./internal/tools/, go test ./internal/agent/... ./internal/container/..., go vet, task lint:imports, task lint: all pass.

Docs

A [DOCS] issue for inference-gateway/docs follows: the tools reference's Read entry and the vision page's line that says arbitrary images are read through ImageDecode.

Read hands an image file (by extension, or sniffed when it has none) to a vision model as an attachment the agent loop sends with the next message, instead of refusing every image.
A text-only model, or a session without an image service, gets an error pointing at ImageDecode, which describes the image in words.
The Read manifest and the golden tool definitions say so.
@edenreich
edenreich requested a review from a team as a code owner October 21, 2026 02:30
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Oct 21, 2026
@edenreich
edenreich merged commit 0908efd into main Oct 21, 2026
1 check passed
@edenreich
edenreich deleted the feat/read-attaches-images branch October 21, 2026 12:46
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.235.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Oct 21, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant