Class: RubyLLM::Agents::CachedBackgroundRemovalResult
- Inherits:
-
Object
- Object
- RubyLLM::Agents::CachedBackgroundRemovalResult
- Defined in:
- lib/ruby_llm/agents/results/background_removal_result.rb
Overview
Lightweight result for cached removals
Instance Attribute Summary collapse
-
#cached_at ⇒ Object
readonly
Returns the value of attribute cached_at.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#mask_data ⇒ Object
readonly
Returns the value of attribute mask_data.
-
#mask_url ⇒ Object
readonly
Returns the value of attribute mask_url.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
-
#output_format ⇒ Object
readonly
Returns the value of attribute output_format.
-
#total_cost ⇒ Object
readonly
Returns the value of attribute total_cost.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #base64? ⇒ Boolean
- #batch? ⇒ Boolean
- #cached? ⇒ Boolean
- #count ⇒ Object
- #datas ⇒ Object
- #error? ⇒ Boolean
- #has_alpha? ⇒ Boolean
-
#initialize(data) ⇒ CachedBackgroundRemovalResult
constructor
A new instance of CachedBackgroundRemovalResult.
- #mask? ⇒ Boolean
- #single? ⇒ Boolean
- #success? ⇒ Boolean
- #urls ⇒ Object
Constructor Details
#initialize(data) ⇒ CachedBackgroundRemovalResult
Returns a new instance of CachedBackgroundRemovalResult.
245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 245 def initialize(data) @url = data[:url] @data = data[:data] @mask_url = data[:mask_url] @mask_data = data[:mask_data] @mime_type = data[:mime_type] @model_id = data[:model_id] @output_format = data[:output_format] @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.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def cached_at @cached_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def data @data end |
#mask_data ⇒ Object (readonly)
Returns the value of attribute mask_data.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def mask_data @mask_data end |
#mask_url ⇒ Object (readonly)
Returns the value of attribute mask_url.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def mask_url @mask_url end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def mime_type @mime_type end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def model_id @model_id end |
#output_format ⇒ Object (readonly)
Returns the value of attribute output_format.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def output_format @output_format end |
#total_cost ⇒ Object (readonly)
Returns the value of attribute total_cost.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def total_cost @total_cost end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
242 243 244 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 242 def url @url end |
Instance Method Details
#base64? ⇒ Boolean
277 278 279 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 277 def base64? !data.nil? end |
#batch? ⇒ Boolean
297 298 299 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 297 def batch? false end |
#cached? ⇒ Boolean
265 266 267 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 265 def cached? true end |
#count ⇒ Object
289 290 291 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 289 def count success? ? 1 : 0 end |
#datas ⇒ Object
273 274 275 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 273 def datas success? ? [data].compact : [] end |
#error? ⇒ Boolean
261 262 263 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 261 def error? !success? end |
#has_alpha? ⇒ Boolean
285 286 287 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 285 def has_alpha? %i[png webp].include?(output_format&.to_sym) end |
#mask? ⇒ Boolean
281 282 283 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 281 def mask? !mask_url.nil? || !mask_data.nil? end |
#single? ⇒ Boolean
293 294 295 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 293 def single? true end |
#success? ⇒ Boolean
257 258 259 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 257 def success? !url.nil? || !data.nil? end |
#urls ⇒ Object
269 270 271 |
# File 'lib/ruby_llm/agents/results/background_removal_result.rb', line 269 def urls success? ? [url].compact : [] end |