Class: RubyLLM::Agents::ImageTransformer
- Inherits:
-
Object
- Object
- RubyLLM::Agents::ImageTransformer
- Extended by:
- DSL
- Includes:
- Execution
- Defined in:
- lib/ruby_llm/agents/image/transformer.rb,
lib/ruby_llm/agents/image/transformer/dsl.rb,
lib/ruby_llm/agents/image/transformer/execution.rb
Overview
Image transformer for style transfer and image-to-image generation
Transforms an existing image based on a text prompt while maintaining the overall structure. The strength parameter controls how much the image is transformed.
Defined Under Namespace
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
Class Method Summary collapse
-
.call(image:, prompt:, **options) ⇒ ImageTransformResult
Execute image transformation.
-
.inherited(subclass) ⇒ Object
Ensure subclasses inherit DSL settings.
Instance Method Summary collapse
-
#call ⇒ ImageTransformResult
Execute the image transformation.
-
#initialize(image:, prompt:, **options) ⇒ ImageTransformer
constructor
Initialize a new image transformer instance.
Methods included from Execution
Constructor Details
#initialize(image:, prompt:, **options) ⇒ ImageTransformer
Initialize a new image transformer instance
79 80 81 82 83 84 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 79 def initialize(image:, prompt:, **) @image = image @prompt = prompt @options = @tenant_id = nil end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
67 68 69 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 67 def image @image end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
67 68 69 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 67 def @options end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
67 68 69 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 67 def prompt @prompt end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
67 68 69 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 67 def tenant_id @tenant_id end |
Class Method Details
.call(image:, prompt:, **options) ⇒ ImageTransformResult
Execute image transformation
46 47 48 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 46 def call(image:, prompt:, **) new(image: image, prompt: prompt, **).call end |
.inherited(subclass) ⇒ Object
Ensure subclasses inherit DSL settings
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 51 def inherited(subclass) super subclass.instance_variable_set(:@model, @model) subclass.instance_variable_set(:@size, @size) subclass.instance_variable_set(:@strength, @strength) subclass.instance_variable_set(:@preserve_composition, @preserve_composition) subclass.instance_variable_set(:@version, @version) subclass.instance_variable_set(:@description, @description) subclass.instance_variable_set(:@cache_ttl, @cache_ttl) subclass.instance_variable_set(:@template_string, @template_string) subclass.instance_variable_set(:@negative_prompt, @negative_prompt) subclass.instance_variable_set(:@guidance_scale, @guidance_scale) subclass.instance_variable_set(:@steps, @steps) end |
Instance Method Details
#call ⇒ ImageTransformResult
Execute the image transformation
89 90 91 |
# File 'lib/ruby_llm/agents/image/transformer.rb', line 89 def call execute end |