Skip to content

fix(llm): accept local .avif attachments like base64 AVIF - #1734

Open
dodoshell wants to merge 1 commit into
RailtownAI:mainfrom
dodoshell:avif-local-attachments
Open

dodoshell wants to merge 1 commit into
RailtownAI:mainfrom
dodoshell:avif-local-attachments

Conversation

@dodoshell

Copy link
Copy Markdown

Summary

Closes #1730. Part of #1347.

Attachment("photo.avif") raised Unsupported attachment format: .avif because .avif was missing from _EXTENSION_MIME_MAP, while the same image as base64 is detected as image/avif since #1623. This adds the .avif entry, so local files and base64 now agree, and a URL ending in .avif gets mime_type="image/avif" instead of falling through with none.

On the provider question from the issue: I went with adding it now rather than waiting for the per-provider allowlists. Base64 AVIF already reaches providers today, so this doesn't open a new path, it just makes the local-file path consistent with it. OpenAI, Anthropic and Gemini will reject it at request time with the generic LLMError; the modalities page now says so. When the allowlists from #1347 land, .avif can be restricted there along with the base64 case.

Type of change

  • Bug fix
  • Feature
  • Breaking change
  • Docs
  • Refactor / chore / build / tests

Checklist

  • Lint & format pass (ruff check . && ruff format .)
  • Tests added/updated and pass locally (pytest tests)
  • Docs updated if user-facing behavior changed
  • Breaking changes include migration notes

Notes

Added .avif to the local-file format cases and a test_url_avif next to test_url; both fail without the change. The unit suite otherwise matches main locally (the Portkey tests and the modules needing extras I don't have installed fail the same way before and after).

This branch has not been deployed

No deployments
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.

Local .avif files are rejected while base64 AVIF is accepted

1 participant