Build an image_url content block from a URL (no download).
(url: str)
| 317 | |
| 318 | |
| 319 | def process_url(url: str) -> Attachment: |
| 320 | """Build an image_url content block from a URL (no download).""" |
| 321 | return Attachment( |
| 322 | source=url, |
| 323 | content_blocks=[ |
| 324 | { |
| 325 | "type": "image_url", |
| 326 | "image_url": {"url": url, "detail": DEFAULT_IMAGE_DETAIL_LEVEL}, |
| 327 | } |
| 328 | ], |
| 329 | display_name=url.rsplit("/", 1)[-1][:60], |
| 330 | size_bytes=0, |
| 331 | mime_type="image/unknown", |
| 332 | ) |
| 333 | |
| 334 | |
| 335 | # ------------------------------------------------------------------ # |