Class: RubyLLM::Agents::CachedImageTransformResult
- Inherits:
-
Object
- Object
- RubyLLM::Agents::CachedImageTransformResult
- Defined in:
- lib/ruby_llm/agents/results/image_transform_result.rb
Overview
Lightweight result for cached transformations
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) ⇒ CachedImageTransformResult
constructor
A new instance of CachedImageTransformResult.
- #single? ⇒ Boolean
- #success? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(data) ⇒ CachedImageTransformResult
Returns a new instance of CachedImageTransformResult.
221 222 223 224 225 226 227 228 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 221 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.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def cached_at @cached_at end |
#datas ⇒ Object (readonly)
Returns the value of attribute datas.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def datas @datas end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def mime_type @mime_type end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def model_id @model_id end |
#total_cost ⇒ Object (readonly)
Returns the value of attribute total_cost.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def total_cost @total_cost end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
219 220 221 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 219 def urls @urls end |
Instance Method Details
#base64? ⇒ Boolean
250 251 252 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 250 def base64? datas.any? end |
#batch? ⇒ Boolean
262 263 264 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 262 def batch? count > 1 end |
#cached? ⇒ Boolean
238 239 240 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 238 def cached? true end |
#count ⇒ Object
254 255 256 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 254 def count [urls.size, datas.size].max end |
#data ⇒ Object
246 247 248 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 246 def data datas.first end |
#error? ⇒ Boolean
234 235 236 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 234 def error? !success? end |
#single? ⇒ Boolean
258 259 260 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 258 def single? count == 1 end |
#success? ⇒ Boolean
230 231 232 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 230 def success? urls.any? || datas.any? end |
#url ⇒ Object
242 243 244 |
# File 'lib/ruby_llm/agents/results/image_transform_result.rb', line 242 def url urls.first end |