Class: RubyLLM::Agents::CachedImageEditResult
- Inherits:
-
Object
- Object
- RubyLLM::Agents::CachedImageEditResult
- Defined in:
- lib/ruby_llm/agents/results/image_edit_result.rb
Overview
Lightweight result for cached edits
Instance Attribute Summary collapse
-
#cached_at ⇒ Object
readonly
Returns the value of attribute cached_at.
-
#datas ⇒ Object
readonly
Returns the value of attribute datas.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
-
#total_cost ⇒ Object
readonly
Returns the value of attribute total_cost.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
- #base64? ⇒ Boolean
- #batch? ⇒ Boolean
- #cached? ⇒ Boolean
- #count ⇒ Object
- #data ⇒ Object
- #error? ⇒ Boolean
-
#initialize(data) ⇒ CachedImageEditResult
constructor
A new instance of CachedImageEditResult.
- #single? ⇒ Boolean
- #success? ⇒ Boolean
- #url ⇒ Object
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_at ⇒ Object (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 |
#datas ⇒ Object (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_type ⇒ Object (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_id ⇒ Object (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_cost ⇒ Object (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 |
#urls ⇒ Object (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
249 250 251 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 249 def base64? datas.any? end |
#batch? ⇒ Boolean
261 262 263 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 261 def batch? count > 1 end |
#cached? ⇒ Boolean
237 238 239 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 237 def cached? true end |
#count ⇒ Object
253 254 255 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 253 def count [urls.size, datas.size].max end |
#data ⇒ Object
245 246 247 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 245 def data datas.first end |
#error? ⇒ Boolean
233 234 235 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 233 def error? !success? end |
#single? ⇒ Boolean
257 258 259 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 257 def single? count == 1 end |
#success? ⇒ Boolean
229 230 231 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 229 def success? urls.any? || datas.any? end |
#url ⇒ Object
241 242 243 |
# File 'lib/ruby_llm/agents/results/image_edit_result.rb', line 241 def url urls.first end |