class

Autobot::Tools::ImageGenerationTool

Inherits Autobot::Tools::Tool < Reference < Object

Tool for generating images from text prompts and sending them to users.

Follows the same send_callback + set_context pattern as MessageTool. When the LLM calls generate_image(prompt), the tool:

  1. Calls the provider's image generation API (OpenAI or Gemini)
  2. Gets base64 image data back
  3. Constructs an OutboundMessage with MediaAttachment
  4. Publishes it via the send callback

Constants

DEFAULT_GEMINI_MODEL = "gemini-2.5-flash-image"
DEFAULT_OPENAI_MODEL = "gpt-image-1"
GEMINI_API_BASE = "https://generativelanguage.googleapis.com"
IMAGE_GEN_TIMEOUT = 120.seconds
Log = ::Log.for("tools.image_generation")
OPENAI_API_BASE = "https://api.openai.com"
VALID_SIZES = ["256x256", "512x512", "1024x1024", "1024x1536", "1536x1024", "auto"]

Constructors

new(api_key : String, provider_name : String, model : String | Nil = nil, size : String = "1024x1024", api_base : String | Nil = nil)
Source

Instance methods

description
Source
execute(params : Hash(String, JSON::Any)) : ToolResult
Source
name
Source
parameters
Source
send_callback=(callback : SendCallback) : Nil
Source
set_context(channel : String, chat_id : String) : Nil
Source