Skip to content

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

Merged
CoronRing merged 3 commits into
RailtownAI:mainfrom
dodoshell:avif-local-attachments
Oct 29, 2026
Merged

CoronRing merged 3 commits into
RailtownAI:mainfrom
dodoshell:avif-local-attachments

Conversation

@dodoshell

Copy link
Copy Markdown
Contributor

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).

@by-ae by-ae mentioned this pull request Oct 22, 2026
6 of 9 tasks

@CoronRing CoronRing left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dodoshell

Thanks, this is good to go once CI is green! It's the one-line fix the issue asked for, the URL test next to test_url is a nice extra, and the PR says clearly which way you went on the provider question, which is exactly what we needed.

One small wording nit, no change needed for this PR: the providers don't list AVIF rather than definitely rejecting it, so I'll soften "do not accept" to "do not list" when I touch that page next.

Heads up on what comes next: #1701 (Attachment v2) replaces _EXTENSION_MIME_MAP with a shared format table. I'll keep your .avif cases when I rebase onto this, so your tests stay in.

Great work; all is clear as day on my side! If you enjoyed the framework, please tell your friends and star the repo so it gets a bit of attention.

Thanks & love from the maintenance team >_<

@CoronRing
CoronRing merged commit e7f4f2d into RailtownAI:main Oct 29, 2026
7 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.

[media] Local .avif files are rejected while base64 AVIF is accepted

2 participants