Repository navigation
Images: generic CallAPI port in the core; rich infographics by default; log each picture's kind - #38
Merged
Merged
Conversation
…sked for The default was a clean, plain technical drawing. With no style named, the brief now asks for a polished infographic (bold title, detailed main illustration, colour-coded sections, icons, callouts, legend), and the tool tells the model to plan its title, callouts with key facts and figures, and legend, as the image model invents no words or numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
So the log says whether a picture went technical or artistic. Never the prompt or the requirements themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
The core mirrored the feature: ImageRequest, GenerateImage, MakesImage and Client.Image existed for imagegen alone. They become one generic service, Host.CallAPI(ctx, path, body): from a tool's Run, post to an endpoint of the model's API. The core keeps the key, adds data_collection deny on OpenRouter, caps size and time, refuses chat completions and outside a tool, and counts usage.cost toward the reply. Info.MakesImage becomes Info.Provider. imagegen builds its /images body and decodes the picture itself. The arch guardrail now names imagegen, make_image and gpt-image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
A nil body panicked on OpenRouter, and provider settings that weren't a map[string]any were dropped for data_collection alone. The provider value now goes through JSON before deny is merged in; one that isn't an object is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A generic core port instead of an image-shaped one
The core mirrored the image feature:
ImageRequest,Host.GenerateImage,Info.MakesImageandmodel.Client.Imageexisted forimagegenalone, which breaks the port rule. They become one generic service:Host.CallAPI(ctx, path, body): from a tool's Run, post a JSON body to an endpoint of the model's API, such as OpenRouter's/images, and get the response back.provider.data_collection: denyinto any provider settings the body has. A provider value that isn't an object is refused.usage.costthe response reports to the reply, soDAILY_BUDGETcounts it./chat/completions, and any path that isn't a plain endpoint.Info.Provider(openrouteror empty) replacesInfo.MakesImage, which was set fromReportsCost().imagegennow builds its own/imagesbody and decodes the picture itself.imagegen,make_imageorgpt-imageappears in core code. CONTRIBUTING and TECHNICAL listCallAPI.Rich infographics by default
A technical picture (diagram, cutaway, schematic, infographic, labelled or educational) came out as a plain technical drawing. Now, unless the user names a style:
A named style still wins, and the accuracy rules are unchanged.
Log the kind
Each picture logs
image asked: technical, 5 requirements, 16:9, so the operator can see whether a request went technical or artistic. It never logs the prompt or the requirements' text.Testing
go vetandgo test -race ./..., with no tags and with-tags nosignal,-tags notelegramand-tags nocharts.model.Client.Call:imagegen: tested against a fakeCallAPI, including the end-to-end scenario where the bot draws a picture.CallAPI. Both bugs it confirmed (a nil body, and dropped provider settings) are fixed with tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01FbGfzi38exq5AFMGFUMRMN