Class: RubyLLM::Agents::CachedImageEditResult

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

Overview

Lightweight result for cached edits

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CachedImageEditResult

Returns a new instance of CachedImageEditResult.



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

def initialize(data)
  @urls = data[:urls] || []
  @datas = data[:datas] || []
  @mime_type = data[:mime_type]
  @model_id = data[:model_id]
  @total_cost = data[:total_cost]
  @cached_at = data[:cached_at]
end

Instance Attribute Details

#cached_atObject (readonly)

Returns the value of attribute cached_at.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def cached_at
  @cached_at
end

#datasObject (readonly)

Returns the value of attribute datas.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def datas
  @datas
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def mime_type
  @mime_type
end

#model_idObject (readonly)

Returns the value of attribute model_id.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def model_id
  @model_id
end

#total_costObject (readonly)

Returns the value of attribute total_cost.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def total_cost
  @total_cost
end

#urlsObject (readonly)

Returns the value of attribute urls.



218
219
220
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 218

def urls
  @urls
end

Instance Method Details

#base64?Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 249

def base64?
  datas.any?
end

#batch?Boolean

Returns:

  • (Boolean)


261
262
263
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 261

def batch?
  count > 1
end

#cached?Boolean

Returns:

  • (Boolean)


237
238
239
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 237

def cached?
  true
end

#countObject



253
254
255
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 253

def count
  [urls.size, datas.size].max
end

#dataObject



245
246
247
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 245

def data
  datas.first
end

#error?Boolean

Returns:

  • (Boolean)


233
234
235
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 233

def error?
  !success?
end

#single?Boolean

Returns:

  • (Boolean)


257
258
259
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 257

def single?
  count == 1
end

#success?Boolean

Returns:

  • (Boolean)


229
230
231
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 229

def success?
  urls.any? || datas.any?
end

#urlObject



241
242
243
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 241

def url
  urls.first
end