module RubyLLM::Providers::Gemini::Images
Public Instance Methods
# File lib/ruby_llm/providers/gemini/images.rb, line 8 def images_url(with: nil, mask: nil) # rubocop:disable Lint/UnusedMethodArgument "models/#{@model}:predict" end
# File lib/ruby_llm/providers/gemini/images.rb, line 27 def parse_image_response(response, model:) data = response.body image_data = data['predictions']&.first unless image_data&.key?('bytesBase64Encoded') raise Error, 'Unexpected response format from Gemini image generation API' end mime_type = image_data['mimeType'] || 'image/png' base64_data = image_data['bytesBase64Encoded'] Image.new( data: base64_data, mime_type: mime_type, model_id: model ) end
# File lib/ruby_llm/providers/gemini/images.rb, line 12 def render_image_payload(prompt, model:, size:, with: nil, mask: nil, params: {}) # rubocop:disable Lint/UnusedMethodArgument,Metrics/ParameterLists RubyLLM.logger.debug { "Ignoring size #{size}. Gemini does not support image size customization." } @model = model { instances: [ { prompt: prompt } ], parameters: { sampleCount: 1 } } end