image

fun image(source: String)(source)

Adds an image attachment to the media content collection.

Creates an image media content item from the specified source. The source can be either a local file path or a URL.

Model type support:

  • Anthropic — supports local and URL images. Formats: png, jpeg, webp, gif

  • Gemini — supports local images only. Formats: png, jpeg, webp, heic, heif, gif

  • Ollama — does not support images yet

  • OpenAI — supports local and URL images. Formats: png, jpeg, webp, gif

  • OpenRouter — supports local and URL images. Formats: png, jpeg, webp, gif

Example:

image("screenshot.png")           // Local file
image("https://example.com/pic.jpg") // URL

Parameters

source

The path to the local image file or URL of the image