feat: add MaxAttachments field to Model struct#259
Open
iceymoss wants to merge 1 commit intocharmbracelet:mainfrom
Open
feat: add MaxAttachments field to Model struct#259iceymoss wants to merge 1 commit intocharmbracelet:mainfrom
iceymoss wants to merge 1 commit intocharmbracelet:mainfrom
Conversation
Add a per-model MaxAttachments field that specifies the maximum number of image attachments allowed in a single request. A value of 0 means no hard limit (context window governs). Set max_attachments: 10 for all Gemini and Vertex AI Gemini models, which enforce a 10-image per-request cap. Closes charmbracelet#258
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.
Summary
MaxAttachments intfield tocatwalk.Modelstruct (json:"max_attachments,omitempty")max_attachments: 10for all Gemini models ingemini.jsonandvertexai.jsonMotivation
Some AI providers enforce hard per-request limits on image attachments. For example, Google Gemini caps at 10 images per request — exceeding this makes sessions permanently unusable (see charmbracelet/crush#2604). Currently there is no way to express this limit in Catwalk's
Modelstruct, forcing downstream consumers to hard-code provider-specific limits.Changes
pkg/catwalk/provider.goSemantics:
0(zero / omitted): no hard limit, rely on context window limits instead> 0: maximum number of image attachments allowed in a single requestinternal/providers/configs/gemini.jsonAdd
"max_attachments": 10to all 6 Gemini models.internal/providers/configs/vertexai.jsonAdd
"max_attachments": 10to all 6 Gemini models. Claude models on Vertex AI are left without the field (no known hard limit).Known limits
Downstream impact
Once this ships, Crush can replace its hard-coded
maxImagesForModel()switch with a simple read frommodel.CatwalkCfg.MaxAttachments, eliminating provider-specific logic from the consumer side.Test plan
go build ./...— passesgo test ./... -count=1— all existing tests passCloses #258