From d58bcacf6513372de3303261bbdf3d7ceb970c99 Mon Sep 17 00:00:00 2001 From: iceymoss Date: Sat, 25 Apr 2026 00:21:12 +0800 Subject: [PATCH] feat: add MaxAttachments field to Model struct 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 #258 --- internal/providers/configs/gemini.json | 18 ++++++++++++------ internal/providers/configs/vertexai.json | 18 ++++++++++++------ pkg/catwalk/provider.go | 1 + 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/internal/providers/configs/gemini.json b/internal/providers/configs/gemini.json index c8a34d7b..57dcebd9 100644 --- a/internal/providers/configs/gemini.json +++ b/internal/providers/configs/gemini.json @@ -19,7 +19,8 @@ "can_reason": true, "reasoning_levels": ["low", "medium", "high"], "default_reasoning_effort": "medium", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3.1-pro-preview-customtools", @@ -33,7 +34,8 @@ "can_reason": true, "reasoning_levels": ["low", "medium", "high"], "default_reasoning_effort": "medium", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3-pro-preview", @@ -47,7 +49,8 @@ "can_reason": true, "reasoning_levels": ["low", "high"], "default_reasoning_effort": "high", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3-flash-preview", @@ -61,7 +64,8 @@ "can_reason": true, "reasoning_levels": ["minimal", "low", "medium", "high"], "default_reasoning_effort": "minimal", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-2.5-pro", @@ -73,7 +77,8 @@ "context_window": 1048576, "default_max_tokens": 50000, "can_reason": true, - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-2.5-flash", @@ -85,7 +90,8 @@ "context_window": 1048576, "default_max_tokens": 50000, "can_reason": true, - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 } ] } diff --git a/internal/providers/configs/vertexai.json b/internal/providers/configs/vertexai.json index b81b77e9..ff0b6904 100644 --- a/internal/providers/configs/vertexai.json +++ b/internal/providers/configs/vertexai.json @@ -19,7 +19,8 @@ "can_reason": true, "reasoning_levels": ["low", "medium", "high"], "default_reasoning_effort": "medium", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3.1-pro-preview-customtools", @@ -33,7 +34,8 @@ "can_reason": true, "reasoning_levels": ["low", "medium", "high"], "default_reasoning_effort": "medium", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3-pro-preview", @@ -47,7 +49,8 @@ "can_reason": true, "reasoning_levels": ["low", "high"], "default_reasoning_effort": "high", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-3-flash-preview", @@ -61,7 +64,8 @@ "can_reason": true, "reasoning_levels": ["minimal", "low", "medium", "high"], "default_reasoning_effort": "minimal", - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-2.5-pro", @@ -73,7 +77,8 @@ "context_window": 1048576, "default_max_tokens": 50000, "can_reason": true, - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "gemini-2.5-flash", @@ -85,7 +90,8 @@ "context_window": 1048576, "default_max_tokens": 50000, "can_reason": true, - "supports_attachments": true + "supports_attachments": true, + "max_attachments": 10 }, { "id": "claude-sonnet-4-6", diff --git a/pkg/catwalk/provider.go b/pkg/catwalk/provider.go index f107df35..ce4b025c 100644 --- a/pkg/catwalk/provider.go +++ b/pkg/catwalk/provider.go @@ -91,6 +91,7 @@ type Model struct { ReasoningLevels []string `json:"reasoning_levels,omitempty"` DefaultReasoningEffort string `json:"default_reasoning_effort,omitempty"` SupportsImages bool `json:"supports_attachments"` + MaxAttachments int `json:"max_attachments,omitempty"` Options ModelOptions `json:"options,omitzero"` }