Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/documentation/agent_design/llms/modalities.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Given the LLM powering your agent, you can pass image inputs to your multimodal
```
The `attachment` parameter can be a single `str` or a `list[str]`. We currently support the following:

- Both file and web URLs of the following types: `jpeg`, `png`, `gif`, and `webp`
- Both file and web URLs of the following types: `jpeg`, `png`, `gif`, `webp`, and `avif` (OpenAI, Anthropic and Gemini do not accept `avif`, but some OpenAI-compatible servers do)
- `byte64` encoded string of the image

A web URL without a file extension (for example a CDN link) is passed to the provider as an image. A URL whose extension names an audio, video, text or Office document file (such as `.mp3`, `.mp4` or `.docx`) raises a `ValueError`, since those formats are not supported as attachments yet. With `trust_urls=True`, such a URL is HEAD-probed first and accepted when the server reports an image or PDF, for example a thumbnail service that renders a frame from a `.mp4` path.
Expand Down
1 change: 1 addition & 0 deletions packages/railtracks/src/railtracks/llm/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
".png": "image/png",
".gif": "image/gif",
".webp": "image/webp",
".avif": "image/avif",
".pdf": "application/pdf",
}

Expand Down
8 changes: 8 additions & 0 deletions packages/railtracks/tests/unit_tests/llm/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class TestAttachment:
(".png", "png"),
(".gif", "gif"),
(".webp", "webp"),
(".avif", "avif"),
(".PNG", "png"),
],
)
Expand Down Expand Up @@ -258,6 +259,13 @@ def test_url(self):
# Image URLs are passed to the provider as-is; no fetch at construction.
assert attachment.encoding is None

def test_url_avif(self):
attachment = Attachment("https://example.com/photo.avif")
assert attachment.type == "url"
assert attachment.modality == "image"
assert attachment.mime_type == "image/avif"
assert attachment.encoding is None

def test_url_with_query_string(self):
url = "https://example.com/photo.png?token=abc&x=1"
attachment = Attachment(url)
Expand Down
Loading