Class: RubyLLM::Agents::CachedImageVariationResult
- Inherits:
-
Object
- Object
- RubyLLM::Agents::CachedImageVariationResult
- Defined in:
- lib/ruby_llm/agents/results/image_variation_result.rb
Overview
Lightweight result for cached variations
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) ⇒ CachedImageVariationResult
constructor
A new instance of CachedImageVariationResult.
- #single? ⇒ Boolean
- #success? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(data) ⇒ CachedImageVariationResult
Returns a new instance of CachedImageVariationResult.
207 208 209 210 211 212 213 214 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 207 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.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def cached_at @cached_at end |
#datas ⇒ Object (readonly)
Returns the value of attribute datas.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def datas @datas end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def mime_type @mime_type end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def model_id @model_id end |
#total_cost ⇒ Object (readonly)
Returns the value of attribute total_cost.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def total_cost @total_cost end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
205 206 207 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 205 def urls @urls end |
Instance Method Details
#base64? ⇒ Boolean
236 237 238 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 236 def base64? datas.any? end |
#batch? ⇒ Boolean
248 249 250 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 248 def batch? count > 1 end |
#cached? ⇒ Boolean
224 225 226 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 224 def cached? true end |
#count ⇒ Object
240 241 242 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 240 def count [urls.size, datas.size].max end |
#data ⇒ Object
232 233 234 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 232 def data datas.first end |
#error? ⇒ Boolean
220 221 222 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 220 def error? !success? end |
#single? ⇒ Boolean
244 245 246 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 244 def single? count == 1 end |
#success? ⇒ Boolean
216 217 218 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 216 def success? urls.any? || datas.any? end |
#url ⇒ Object
228 229 230 |
# File 'lib/ruby_llm/agents/results/image_variation_result.rb', line 228 def url urls.first end |