Skip to content

Commit 60b776a

Browse files
committed
improvement(providers): align attachment dispatch to vendor SDK types
Post-merge audit of #4610 surfaced three follow-ups: 1. xAI Grok vision was blocked. Grok runs through the OpenAI-compatible chat-completions endpoint, so removing xAI from UNSUPPORTED_FILE_PROVIDERS and routing it through the image-only branch restores image attachments on vision models. 2. Azure OpenAI chat-completions deployments blocked any file attachment. Added a per-message image_url parts path; documents still require the Responses API endpoint and throw a clear, actionable error. 3. Wire shapes were loosely typed (Record<string, unknown> arrays). Replaced with `satisfies` clauses against each vendor SDK union at every push site: OpenAI Responses/Chat, Anthropic ContentBlockParam, Gemini Part, Bedrock ContentBlock members. AnthropicImageMediaType now derives from Base64ImageSource['media_type'] so it tracks SDK updates. Also collapsed the validation cascade into an exhaustive switch with `never` enforcement, and dropped the redundant per-provider formatMessagesForProvider call from xai/index.ts (providers/index.ts already runs the dispatcher centrally).
1 parent a64b338 commit 60b776a

5 files changed

Lines changed: 150 additions & 90 deletions

File tree

apps/sim/providers/attachments.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ describe('provider attachments', () => {
6666
{
6767
type: 'input_image',
6868
image_url: 'data:image/png;base64,iVBORw0KGgo=',
69+
detail: 'auto',
6970
},
7071
{
7172
type: 'input_file',

0 commit comments

Comments
 (0)