Module: RubyLLM::Agents::ImageEditor::Execution
- Includes:
- Concerns::ImageOperationExecution
- Included in:
- RubyLLM::Agents::ImageEditor
- Defined in:
- lib/ruby_llm/agents/image/editor/execution.rb
Overview
Execution logic for image editors
Handles image/mask validation, content policy checks, budget tracking, caching, image editing, and result building.
Instance Method Summary collapse
-
#execute ⇒ ImageEditResult
Execute the image editing pipeline.
Instance Method Details
#execute ⇒ ImageEditResult
Execute the image editing pipeline
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ruby_llm/agents/image/editor/execution.rb', line 20 def execute started_at = Time.current resolve_tenant_context! check_budget! if budget_tracking_enabled? validate_inputs! # Check cache cached = check_cache(ImageEditResult) if cache_enabled? return cached if cached # Edit image(s) edited_images = edit_images # Build result result = build_result( images: edited_images, started_at: started_at, completed_at: Time.current ) # Cache result write_cache(result) if cache_enabled? # Track execution record_execution(result) if execution_tracking_enabled? result rescue => e record_failed_execution(e, started_at) if execution_tracking_enabled? build_error_result(e, started_at) end |