e.g. remix-run/remix
Show issues from last 30 days

background

google vertex anthropic provider was throwing cryptic "url sources are not supported" errors after commit aeba38e added url support to base anthropic provider. both providers share the same anthropicmessageslanguagemodel but vertex has supportsimageurls: false while base has true. issue #6453

summary

removed unnecessary url validation from anthropic provider conversion logic:

  • removed supportsImageUrls parameter from convertToAnthropicMessagesPrompt function
  • removed url validation checks that threw errors for url-based images and pdf files
  • updated AnthropicMessagesLanguageModel to no longer pass supportsImageUrls setting
  • updated tests to verify url-based images and pdfs are properly passed through
  • relies on AI SDK core convertToLanguageModelPrompt to handle url downloading when needed

verification

  • all 64 anthropic tests pass in both node and edge environments
  • all 68 google vertex tests pass including anthropic provider tests
  • url-based images and pdf files are properly converted to anthropic format
  • ai sdk core automatically downloads urls when modelSupportsImageUrls is false
  • provider-level conversion trusts that urls have been pre-processed by ai sdk core

tasks

  • removed supportsImageUrls parameter from conversion function
  • removed url validation error throwing logic
  • updated anthropic language model to not pass supportsImageUrls
  • updated tests to verify url passthrough instead of error throwing
  • verified ai sdk core handles url downloading automatically
  • all anthropic tests passing (64 tests)
  • all google vertex tests passing (68 tests)

implementation details

the fix relies on the two-layer architecture of the ai sdk:

  • ai sdk core layer: convertToLanguageModelPrompt() handles url downloading when modelSupportsImageUrls: false or modelSupportsUrl() returns false
  • provider layer: convertToAnthropicMessagesPrompt() trusts that urls have been pre-processed and focuses only on anthropic-specific formatting

this approach eliminates the error users were seeing while maintaining the proper url handling behavior through the established ai sdk patterns.

personal note

simpler fix that leverages existing ai sdk architecture. url downloading happens automatically at the right level without provider-specific validation logic.

Next issue in about 3 hours