Skip to content

fix: correct URL handling for document and media input#251

Merged
Kamilbenkirane merged 1 commit intomainfrom
fix/media-url-handling
Mar 28, 2026
Merged

fix: correct URL handling for document and media input#251
Kamilbenkirane merged 1 commit intomainfrom
fix/media-url-handling

Conversation

@Kamilbenkirane
Copy link
Copy Markdown
Member

Summary

  • OpenResponses: Use file_url field for URL-based documents instead of file_data (which only accepts base64 data URIs)
  • Google: Include mime_type in file_data when using URL-based artifacts, fixing Unsupported MIME type errors for all media types (images, video, audio, documents)
  • Replace empty test PDF skeleton with one containing actual "Hello World" text

Root cause

Two bugs discovered during integration testing of #249:

Provider Bug Fix
OpenResponses (OpenAI) Raw URL put into file_data — API expects data:mime;base64,... format there Branch on doc.url: use file_url for URLs, file_data for base64
Google (Gemini) build_media_part() omitted mime_type from file_data on URL path Include artifact.mime_type.value when available

Test plan

  • 555 unit tests pass (2 new URL-path tests)
  • Integration tested: Anthropic, Google, OpenAI, Mistral all pass with URL documents
  • Google fix applies to all media types (images, video, audio), not just documents

OpenResponses: use file_url field for URL-based documents instead of
file_data (which expects base64 data URIs only).

Google: include mime_type in file_data when using URL-based artifacts,
fixing "Unsupported MIME type" errors for all media types.

Also replaces empty test PDF with one containing actual text content.
@claude
Copy link
Copy Markdown

claude bot commented Mar 28, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@Kamilbenkirane Kamilbenkirane merged commit ec1af58 into main Mar 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant