Module: RubyLLM::Agents::Concerns::ImageOperationDSL
- Included in:
- BackgroundRemover::DSL, ImageAnalyzer::DSL, ImageEditor::DSL, ImageTransformer::DSL, ImageUpscaler::DSL, ImageVariator::DSL
- Defined in:
- lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb
Overview
Shared DSL methods for all image operation classes
Provides common configuration options like model, description, and caching that are shared across ImageVariator, ImageEditor, ImageTransformer, and ImageUpscaler.
Instance Method Summary collapse
-
#cache_enabled? ⇒ Boolean
Check if caching is enabled.
-
#cache_for(ttl) ⇒ Object
Enable caching with the given TTL.
-
#cache_ttl ⇒ ActiveSupport::Duration, ...
Get the cache TTL.
-
#description(value = nil) ⇒ String?
Set or get the description.
-
#model(value = nil) ⇒ String
Set or get the model.
Instance Method Details
#cache_enabled? ⇒ Boolean
Check if caching is enabled
54 55 56 |
# File 'lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb', line 54 def cache_enabled? !cache_ttl.nil? end |
#cache_for(ttl) ⇒ Object
Enable caching with the given TTL
40 41 42 |
# File 'lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb', line 40 def cache_for(ttl) @cache_ttl = ttl end |
#cache_ttl ⇒ ActiveSupport::Duration, ...
Get the cache TTL
47 48 49 |
# File 'lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb', line 47 def cache_ttl @cache_ttl || inherited_or_default(:cache_ttl, nil) end |
#description(value = nil) ⇒ String?
Set or get the description
29 30 31 32 33 34 35 |
# File 'lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb', line 29 def description(value = nil) if value @description = value else @description || inherited_or_default(:description, nil) end end |
#model(value = nil) ⇒ String
Set or get the model
17 18 19 20 21 22 23 |
# File 'lib/ruby_llm/agents/image/concerns/image_operation_dsl.rb', line 17 def model(value = nil) if value @model = value else @model || inherited_or_default(:model, default_model) end end |