Class: RubyLLM::Agents::CachedImageUpscaleResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/agents/results/image_upscale_result.rb

Overview

Lightweight result for cached upscales

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CachedImageUpscaleResult

Returns a new instance of CachedImageUpscaleResult.



219
220
221
222
223
224
225
226
227
228
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 219

def initialize(data)
  @url = data[:url]
  @data = data[:data]
  @mime_type = data[:mime_type]
  @model_id = data[:model_id]
  @scale = data[:scale]
  @output_size = data[:output_size]
  @total_cost = data[:total_cost]
  @cached_at = data[:cached_at]
end

Instance Attribute Details

#cached_atObject (readonly)

Returns the value of attribute cached_at.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def cached_at
  @cached_at
end

#dataObject (readonly)

Returns the value of attribute data.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def data
  @data
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def mime_type
  @mime_type
end

#model_idObject (readonly)

Returns the value of attribute model_id.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def model_id
  @model_id
end

#output_sizeObject (readonly)

Returns the value of attribute output_size.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def output_size
  @output_size
end

#scaleObject (readonly)

Returns the value of attribute scale.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def scale
  @scale
end

#total_costObject (readonly)

Returns the value of attribute total_cost.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def total_cost
  @total_cost
end

#urlObject (readonly)

Returns the value of attribute url.



216
217
218
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 216

def url
  @url
end

Instance Method Details

#base64?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 250

def base64?
  !data.nil?
end

#batch?Boolean

Returns:

  • (Boolean)


262
263
264
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 262

def batch?
  false
end

#cached?Boolean

Returns:

  • (Boolean)


238
239
240
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 238

def cached?
  true
end

#countObject



254
255
256
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 254

def count
  success? ? 1 : 0
end

#datasObject



246
247
248
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 246

def datas
  success? ? [data].compact : []
end

#error?Boolean

Returns:

  • (Boolean)


234
235
236
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 234

def error?
  !success?
end

#single?Boolean

Returns:

  • (Boolean)


258
259
260
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 258

def single?
  true
end

#sizeObject



266
267
268
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 266

def size
  output_size
end

#success?Boolean

Returns:

  • (Boolean)


230
231
232
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 230

def success?
  !url.nil? || !data.nil?
end

#urlsObject



242
243
244
# File 'lib/ruby_llm/agents/results/image_upscale_result.rb', line 242

def urls
  success? ? [url].compact : []
end