ruby_llm-agents 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/ruby_llm/agents/paginatable.rb +9 -3
  3. data/app/controllers/concerns/ruby_llm/agents/sortable.rb +58 -0
  4. data/app/controllers/ruby_llm/agents/agents_controller.rb +59 -16
  5. data/app/controllers/ruby_llm/agents/dashboard_controller.rb +144 -20
  6. data/app/controllers/ruby_llm/agents/executions_controller.rb +13 -16
  7. data/app/controllers/ruby_llm/agents/workflows_controller.rb +279 -90
  8. data/app/helpers/ruby_llm/agents/application_helper.rb +100 -0
  9. data/app/mailers/ruby_llm/agents/alert_mailer.rb +84 -0
  10. data/app/mailers/ruby_llm/agents/application_mailer.rb +28 -0
  11. data/app/models/ruby_llm/agents/execution/analytics.rb +170 -20
  12. data/app/models/ruby_llm/agents/execution/scopes.rb +0 -31
  13. data/app/models/ruby_llm/agents/execution/workflow.rb +0 -129
  14. data/app/models/ruby_llm/agents/execution.rb +50 -14
  15. data/app/models/ruby_llm/agents/tenant/budgetable.rb +277 -0
  16. data/app/models/ruby_llm/agents/tenant/configurable.rb +135 -0
  17. data/app/models/ruby_llm/agents/tenant/trackable.rb +310 -0
  18. data/app/models/ruby_llm/agents/tenant.rb +146 -0
  19. data/app/models/ruby_llm/agents/tenant_budget.rb +12 -253
  20. data/app/services/ruby_llm/agents/agent_registry.rb +18 -12
  21. data/app/views/layouts/ruby_llm/agents/application.html.erb +72 -76
  22. data/app/views/ruby_llm/agents/agents/_agent.html.erb +0 -12
  23. data/app/views/ruby_llm/agents/agents/_sortable_header.html.erb +56 -0
  24. data/app/views/ruby_llm/agents/agents/_workflow.html.erb +5 -15
  25. data/app/views/ruby_llm/agents/agents/index.html.erb +271 -100
  26. data/app/views/ruby_llm/agents/agents/show.html.erb +1 -0
  27. data/app/views/ruby_llm/agents/alert_mailer/alert_notification.html.erb +107 -0
  28. data/app/views/ruby_llm/agents/alert_mailer/alert_notification.text.erb +18 -0
  29. data/app/views/ruby_llm/agents/api_configurations/show.html.erb +4 -1
  30. data/app/views/ruby_llm/agents/dashboard/_agent_comparison.html.erb +66 -359
  31. data/app/views/ruby_llm/agents/dashboard/_model_comparison.html.erb +56 -0
  32. data/app/views/ruby_llm/agents/dashboard/_model_cost_breakdown.html.erb +115 -0
  33. data/app/views/ruby_llm/agents/dashboard/_now_strip.html.erb +35 -60
  34. data/app/views/ruby_llm/agents/dashboard/_top_errors.html.erb +17 -6
  35. data/app/views/ruby_llm/agents/dashboard/index.html.erb +373 -72
  36. data/app/views/ruby_llm/agents/executions/_execution.html.erb +0 -1
  37. data/app/views/ruby_llm/agents/executions/_filters.html.erb +51 -39
  38. data/app/views/ruby_llm/agents/executions/_list.html.erb +53 -195
  39. data/app/views/ruby_llm/agents/executions/_workflow_summary.html.erb +5 -20
  40. data/app/views/ruby_llm/agents/executions/index.html.erb +7 -83
  41. data/app/views/ruby_llm/agents/executions/show.html.erb +10 -20
  42. data/app/views/ruby_llm/agents/shared/_agent_type_badge.html.erb +2 -1
  43. data/app/views/ruby_llm/agents/shared/_doc_link.html.erb +12 -0
  44. data/app/views/ruby_llm/agents/shared/_executions_table.html.erb +3 -15
  45. data/app/views/ruby_llm/agents/shared/_filter_dropdown.html.erb +1 -1
  46. data/app/views/ruby_llm/agents/shared/_select_dropdown.html.erb +1 -1
  47. data/app/views/ruby_llm/agents/shared/_sortable_header.html.erb +53 -0
  48. data/app/views/ruby_llm/agents/shared/_status_badge.html.erb +7 -0
  49. data/app/views/ruby_llm/agents/shared/_status_dot.html.erb +1 -1
  50. data/app/views/ruby_llm/agents/shared/_workflow_type_badge.html.erb +9 -35
  51. data/app/views/ruby_llm/agents/system_config/show.html.erb +4 -1
  52. data/app/views/ruby_llm/agents/tenants/index.html.erb +4 -1
  53. data/app/views/ruby_llm/agents/workflows/_step_performance.html.erb +7 -15
  54. data/app/views/ruby_llm/agents/workflows/_structure_dsl.html.erb +539 -0
  55. data/app/views/ruby_llm/agents/workflows/_workflow_diagram.html.erb +920 -0
  56. data/app/views/ruby_llm/agents/workflows/index.html.erb +179 -0
  57. data/app/views/ruby_llm/agents/workflows/show.html.erb +164 -139
  58. data/config/routes.rb +1 -1
  59. data/lib/generators/ruby_llm_agents/agent_generator.rb +6 -36
  60. data/lib/generators/ruby_llm_agents/background_remover_generator.rb +7 -37
  61. data/lib/generators/ruby_llm_agents/embedder_generator.rb +5 -38
  62. data/lib/generators/ruby_llm_agents/image_analyzer_generator.rb +7 -37
  63. data/lib/generators/ruby_llm_agents/image_editor_generator.rb +7 -37
  64. data/lib/generators/ruby_llm_agents/image_generator_generator.rb +8 -41
  65. data/lib/generators/ruby_llm_agents/image_pipeline_generator.rb +18 -46
  66. data/lib/generators/ruby_llm_agents/image_transformer_generator.rb +7 -37
  67. data/lib/generators/ruby_llm_agents/image_upscaler_generator.rb +7 -37
  68. data/lib/generators/ruby_llm_agents/image_variator_generator.rb +7 -37
  69. data/lib/generators/ruby_llm_agents/install_generator.rb +33 -56
  70. data/lib/generators/ruby_llm_agents/migrate_structure_generator.rb +480 -0
  71. data/lib/generators/ruby_llm_agents/multi_tenancy_generator.rb +42 -22
  72. data/lib/generators/ruby_llm_agents/restructure_generator.rb +2 -2
  73. data/lib/generators/ruby_llm_agents/speaker_generator.rb +8 -39
  74. data/lib/generators/ruby_llm_agents/templates/add_tenant_to_executions_migration.rb.tt +13 -2
  75. data/lib/generators/ruby_llm_agents/templates/agent.rb.tt +5 -8
  76. data/lib/generators/ruby_llm_agents/templates/application_agent.rb.tt +40 -42
  77. data/lib/generators/ruby_llm_agents/templates/application_background_remover.rb.tt +20 -22
  78. data/lib/generators/ruby_llm_agents/templates/application_embedder.rb.tt +24 -26
  79. data/lib/generators/ruby_llm_agents/templates/application_image_analyzer.rb.tt +20 -22
  80. data/lib/generators/ruby_llm_agents/templates/application_image_editor.rb.tt +19 -17
  81. data/lib/generators/ruby_llm_agents/templates/application_image_generator.rb.tt +31 -33
  82. data/lib/generators/ruby_llm_agents/templates/application_image_pipeline.rb.tt +125 -127
  83. data/lib/generators/ruby_llm_agents/templates/application_image_transformer.rb.tt +20 -18
  84. data/lib/generators/ruby_llm_agents/templates/application_image_upscaler.rb.tt +19 -17
  85. data/lib/generators/ruby_llm_agents/templates/application_image_variator.rb.tt +19 -17
  86. data/lib/generators/ruby_llm_agents/templates/application_speaker.rb.tt +38 -40
  87. data/lib/generators/ruby_llm_agents/templates/application_transcriber.rb.tt +42 -44
  88. data/lib/generators/ruby_llm_agents/templates/application_workflow.rb.tt +48 -0
  89. data/lib/generators/ruby_llm_agents/templates/background_remover.rb.tt +19 -21
  90. data/lib/generators/ruby_llm_agents/templates/create_tenant_budgets_migration.rb.tt +11 -0
  91. data/lib/generators/ruby_llm_agents/templates/create_tenants_migration.rb.tt +72 -0
  92. data/lib/generators/ruby_llm_agents/templates/embedder.rb.tt +19 -21
  93. data/lib/generators/ruby_llm_agents/templates/image_analyzer.rb.tt +20 -22
  94. data/lib/generators/ruby_llm_agents/templates/image_editor.rb.tt +15 -17
  95. data/lib/generators/ruby_llm_agents/templates/image_generator.rb.tt +25 -27
  96. data/lib/generators/ruby_llm_agents/templates/image_pipeline.rb.tt +19 -21
  97. data/lib/generators/ruby_llm_agents/templates/image_transformer.rb.tt +20 -22
  98. data/lib/generators/ruby_llm_agents/templates/image_upscaler.rb.tt +17 -19
  99. data/lib/generators/ruby_llm_agents/templates/image_variator.rb.tt +15 -17
  100. data/lib/generators/ruby_llm_agents/templates/rename_tenant_budgets_to_tenants_migration.rb.tt +34 -0
  101. data/lib/generators/ruby_llm_agents/templates/skills/AGENTS.md.tt +87 -24
  102. data/lib/generators/ruby_llm_agents/templates/skills/BACKGROUND_REMOVERS.md.tt +21 -27
  103. data/lib/generators/ruby_llm_agents/templates/skills/EMBEDDERS.md.tt +46 -54
  104. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_ANALYZERS.md.tt +31 -39
  105. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_EDITORS.md.tt +22 -28
  106. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_GENERATORS.md.tt +53 -63
  107. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_PIPELINES.md.tt +46 -56
  108. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_TRANSFORMERS.md.tt +23 -31
  109. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_UPSCALERS.md.tt +22 -30
  110. data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_VARIATORS.md.tt +23 -31
  111. data/lib/generators/ruby_llm_agents/templates/skills/SPEAKERS.md.tt +38 -46
  112. data/lib/generators/ruby_llm_agents/templates/skills/TOOLS.md.tt +7 -7
  113. data/lib/generators/ruby_llm_agents/templates/skills/TRANSCRIBERS.md.tt +59 -71
  114. data/lib/generators/ruby_llm_agents/templates/skills/WORKFLOWS.md.tt +274 -23
  115. data/lib/generators/ruby_llm_agents/templates/speaker.rb.tt +29 -31
  116. data/lib/generators/ruby_llm_agents/templates/transcriber.rb.tt +28 -30
  117. data/lib/generators/ruby_llm_agents/transcriber_generator.rb +10 -43
  118. data/lib/generators/ruby_llm_agents/upgrade_generator.rb +26 -0
  119. data/lib/ruby_llm/agents/core/configuration.rb +55 -43
  120. data/lib/ruby_llm/agents/core/llm_tenant.rb +60 -60
  121. data/lib/ruby_llm/agents/core/version.rb +1 -1
  122. data/lib/ruby_llm/agents/infrastructure/alert_manager.rb +26 -0
  123. data/lib/ruby_llm/agents/infrastructure/budget/config_resolver.rb +4 -2
  124. data/lib/ruby_llm/agents/pipeline.rb +69 -0
  125. data/lib/ruby_llm/agents/workflow/approval.rb +205 -0
  126. data/lib/ruby_llm/agents/workflow/approval_store.rb +179 -0
  127. data/lib/ruby_llm/agents/workflow/dsl/executor.rb +467 -0
  128. data/lib/ruby_llm/agents/workflow/dsl/input_schema.rb +244 -0
  129. data/lib/ruby_llm/agents/workflow/dsl/iteration_executor.rb +289 -0
  130. data/lib/ruby_llm/agents/workflow/dsl/parallel_group.rb +107 -0
  131. data/lib/ruby_llm/agents/workflow/dsl/route_builder.rb +150 -0
  132. data/lib/ruby_llm/agents/workflow/dsl/schedule_helpers.rb +187 -0
  133. data/lib/ruby_llm/agents/workflow/dsl/step_config.rb +352 -0
  134. data/lib/ruby_llm/agents/workflow/dsl/step_executor.rb +415 -0
  135. data/lib/ruby_llm/agents/workflow/dsl/wait_config.rb +257 -0
  136. data/lib/ruby_llm/agents/workflow/dsl/wait_executor.rb +317 -0
  137. data/lib/ruby_llm/agents/workflow/dsl.rb +576 -0
  138. data/lib/ruby_llm/agents/workflow/instrumentation.rb +2 -7
  139. data/lib/ruby_llm/agents/workflow/notifiers/base.rb +117 -0
  140. data/lib/ruby_llm/agents/workflow/notifiers/email.rb +117 -0
  141. data/lib/ruby_llm/agents/workflow/notifiers/slack.rb +180 -0
  142. data/lib/ruby_llm/agents/workflow/notifiers/webhook.rb +121 -0
  143. data/lib/ruby_llm/agents/workflow/notifiers.rb +70 -0
  144. data/lib/ruby_llm/agents/workflow/orchestrator.rb +190 -23
  145. data/lib/ruby_llm/agents/workflow/result.rb +202 -0
  146. data/lib/ruby_llm/agents/workflow/throttle_manager.rb +206 -0
  147. data/lib/ruby_llm/agents/workflow/wait_result.rb +213 -0
  148. metadata +43 -6
  149. data/app/views/ruby_llm/agents/dashboard/_execution_item.html.erb +0 -66
  150. data/lib/ruby_llm/agents/workflow/parallel.rb +0 -299
  151. data/lib/ruby_llm/agents/workflow/pipeline.rb +0 -306
  152. data/lib/ruby_llm/agents/workflow/router.rb +0 -429
@@ -1,139 +1,137 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module <%= @root_namespace %>
4
- module Image
5
- # ApplicationImagePipeline - Base class for all image pipelines in this application
6
- #
7
- # All image pipelines inherit from this class. Configure shared settings here
8
- # that apply to all pipelines, or override them per-pipeline as needed.
9
- #
10
- # ============================================================================
11
- # IMAGE PIPELINE DSL REFERENCE
12
- # ============================================================================
13
- #
14
- # STEP DEFINITION:
15
- # ----------------
16
- # step :name, generator: MyGenerator # Text-to-image generation
17
- # step :name, upscaler: MyUpscaler # Resolution enhancement
18
- # step :name, transformer: MyTransformer # Style transfer / img2img
19
- # step :name, editor: MyEditor # Inpainting / editing
20
- # step :name, variator: MyVariator # Generate variations
21
- # step :name, analyzer: MyAnalyzer # Image analysis (non-image output)
22
- # step :name, remover: MyRemover # Background removal
23
- #
24
- # CONDITIONAL STEPS:
25
- # ------------------
26
- # step :upscale, upscaler: MyUpscaler, if: ->(ctx) { ctx[:high_quality] }
27
- # step :remove_bg, remover: MyRemover, unless: ->(ctx) { ctx[:keep_background] }
28
- #
29
- # STEP OPTIONS:
30
- # -------------
31
- # step :upscale, upscaler: PhotoUpscaler, scale: 4
32
- # step :transform, transformer: StyleTransformer, strength: 0.8
33
- #
34
- # CALLBACKS:
35
- # ----------
36
- # before_pipeline :validate_inputs
37
- # after_pipeline :add_watermark
38
- # after_pipeline { |result| notify_completion(result) }
39
- #
40
- # ERROR HANDLING:
41
- # ---------------
42
- # stop_on_error true # Stop pipeline on first error (default)
43
- # stop_on_error false # Continue even if a step fails
44
- #
45
- # CACHING:
46
- # --------
47
- # cache_for 1.hour # Cache pipeline results
48
- #
49
- # METADATA:
50
- # ---------
51
- # version "1.0" # Version identifier (affects cache key)
52
- # description "My pipeline" # Human-readable description
53
- #
54
- # ============================================================================
55
- # USAGE EXAMPLES
56
- # ============================================================================
57
- #
58
- # # Simple pipeline
59
- # class ProductPipeline < ApplicationImagePipeline
60
- # step :generate, generator: ProductGenerator
61
- # step :upscale, upscaler: PhotoUpscaler, scale: 2
62
- # end
63
- #
64
- # result = ProductPipeline.call(prompt: "Laptop on desk")
65
- # result.final_image # => URL or data of processed image
66
- # result.total_cost # => Combined cost of all steps
67
- #
68
- # # Pipeline with analysis
69
- # class AnalysisPipeline < ApplicationImagePipeline
70
- # step :generate, generator: ProductGenerator
71
- # step :analyze, analyzer: ContentAnalyzer
72
- # end
73
- #
74
- # result = AnalysisPipeline.call(prompt: "Product photo")
75
- # result.analysis # => ImageAnalysisResult
76
- #
77
- # # Conditional pipeline
78
- # class SmartPipeline < ApplicationImagePipeline
79
- # step :generate, generator: ProductGenerator
80
- # step :upscale, upscaler: PhotoUpscaler, if: ->(ctx) { ctx[:hd] }
81
- # step :remove_background, remover: BackgroundRemover, if: ->(ctx) { ctx[:transparent] }
82
- # end
83
- #
84
- # result = SmartPipeline.call(prompt: "...", hd: true, transparent: false)
85
- #
86
- # ============================================================================
87
- # RESULT ACCESS
88
- # ============================================================================
89
- #
90
- # result.success? # All steps succeeded
91
- # result.partial? # Some steps succeeded, some failed
92
- # result.error? # Pipeline failed
93
- #
94
- # result.step(:generate) # Access specific step result
95
- # result.steps # Array of all step results
96
- # result.step_count # Total number of steps
97
- #
98
- # result.final_image # Final processed image (URL or data)
99
- # result.url # Final image URL
100
- # result.to_blob # Final image binary data
101
- # result.save("output.png") # Save final image to file
102
- #
103
- # result.total_cost # Combined cost of all steps
104
- # result.duration_ms # Total pipeline duration
105
- #
106
- class ApplicationImagePipeline < RubyLLM::Agents::ImagePipeline
107
- # ============================================
108
- # Shared Pipeline Configuration
109
- # ============================================
110
- # These settings are inherited by all pipelines
3
+ module Images
4
+ # ApplicationImagePipeline - Base class for all image pipelines in this application
5
+ #
6
+ # All image pipelines inherit from this class. Configure shared settings here
7
+ # that apply to all pipelines, or override them per-pipeline as needed.
8
+ #
9
+ # ============================================================================
10
+ # IMAGE PIPELINE DSL REFERENCE
11
+ # ============================================================================
12
+ #
13
+ # STEP DEFINITION:
14
+ # ----------------
15
+ # step :name, generator: MyGenerator # Text-to-image generation
16
+ # step :name, upscaler: MyUpscaler # Resolution enhancement
17
+ # step :name, transformer: MyTransformer # Style transfer / img2img
18
+ # step :name, editor: MyEditor # Inpainting / editing
19
+ # step :name, variator: MyVariator # Generate variations
20
+ # step :name, analyzer: MyAnalyzer # Image analysis (non-image output)
21
+ # step :name, remover: MyRemover # Background removal
22
+ #
23
+ # CONDITIONAL STEPS:
24
+ # ------------------
25
+ # step :upscale, upscaler: MyUpscaler, if: ->(ctx) { ctx[:high_quality] }
26
+ # step :remove_bg, remover: MyRemover, unless: ->(ctx) { ctx[:keep_background] }
27
+ #
28
+ # STEP OPTIONS:
29
+ # -------------
30
+ # step :upscale, upscaler: PhotoUpscaler, scale: 4
31
+ # step :transform, transformer: StyleTransformer, strength: 0.8
32
+ #
33
+ # CALLBACKS:
34
+ # ----------
35
+ # before_pipeline :validate_inputs
36
+ # after_pipeline :add_watermark
37
+ # after_pipeline { |result| notify_completion(result) }
38
+ #
39
+ # ERROR HANDLING:
40
+ # ---------------
41
+ # stop_on_error true # Stop pipeline on first error (default)
42
+ # stop_on_error false # Continue even if a step fails
43
+ #
44
+ # CACHING:
45
+ # --------
46
+ # cache_for 1.hour # Cache pipeline results
47
+ #
48
+ # METADATA:
49
+ # ---------
50
+ # version "1.0" # Version identifier (affects cache key)
51
+ # description "My pipeline" # Human-readable description
52
+ #
53
+ # ============================================================================
54
+ # USAGE EXAMPLES
55
+ # ============================================================================
56
+ #
57
+ # # Simple pipeline
58
+ # class ProductPipeline < ApplicationImagePipeline
59
+ # step :generate, generator: ProductGenerator
60
+ # step :upscale, upscaler: PhotoUpscaler, scale: 2
61
+ # end
62
+ #
63
+ # result = ProductPipeline.call(prompt: "Laptop on desk")
64
+ # result.final_image # => URL or data of processed image
65
+ # result.total_cost # => Combined cost of all steps
66
+ #
67
+ # # Pipeline with analysis
68
+ # class AnalysisPipeline < ApplicationImagePipeline
69
+ # step :generate, generator: ProductGenerator
70
+ # step :analyze, analyzer: ContentAnalyzer
71
+ # end
72
+ #
73
+ # result = AnalysisPipeline.call(prompt: "Product photo")
74
+ # result.analysis # => ImageAnalysisResult
75
+ #
76
+ # # Conditional pipeline
77
+ # class SmartPipeline < ApplicationImagePipeline
78
+ # step :generate, generator: ProductGenerator
79
+ # step :upscale, upscaler: PhotoUpscaler, if: ->(ctx) { ctx[:hd] }
80
+ # step :remove_background, remover: BackgroundRemover, if: ->(ctx) { ctx[:transparent] }
81
+ # end
82
+ #
83
+ # result = SmartPipeline.call(prompt: "...", hd: true, transparent: false)
84
+ #
85
+ # ============================================================================
86
+ # RESULT ACCESS
87
+ # ============================================================================
88
+ #
89
+ # result.success? # All steps succeeded
90
+ # result.partial? # Some steps succeeded, some failed
91
+ # result.error? # Pipeline failed
92
+ #
93
+ # result.step(:generate) # Access specific step result
94
+ # result.steps # Array of all step results
95
+ # result.step_count # Total number of steps
96
+ #
97
+ # result.final_image # Final processed image (URL or data)
98
+ # result.url # Final image URL
99
+ # result.to_blob # Final image binary data
100
+ # result.save("output.png") # Save final image to file
101
+ #
102
+ # result.total_cost # Combined cost of all steps
103
+ # result.duration_ms # Total pipeline duration
104
+ #
105
+ class ApplicationImagePipeline < RubyLLM::Agents::ImagePipeline
106
+ # ============================================
107
+ # Shared Pipeline Configuration
108
+ # ============================================
109
+ # These settings are inherited by all pipelines
111
110
 
112
- # stop_on_error true # Stop on first step failure
111
+ # stop_on_error true # Stop on first step failure
113
112
 
114
- # ============================================
115
- # Shared Caching
116
- # ============================================
113
+ # ============================================
114
+ # Shared Caching
115
+ # ============================================
117
116
 
118
- # cache_for 30.minutes # Enable caching for all pipelines
117
+ # cache_for 30.minutes # Enable caching for all pipelines
119
118
 
120
- # ============================================
121
- # Shared Callbacks
122
- # ============================================
123
- # Define methods here that can be used by all pipelines
119
+ # ============================================
120
+ # Shared Callbacks
121
+ # ============================================
122
+ # Define methods here that can be used by all pipelines
124
123
 
125
- # before_pipeline :validate_tenant
126
- # after_pipeline :log_completion
124
+ # before_pipeline :validate_tenant
125
+ # after_pipeline :log_completion
127
126
 
128
- # private
127
+ # private
129
128
 
130
- # def validate_tenant
131
- # raise ArgumentError, "Tenant required" unless context[:tenant]
132
- # end
129
+ # def validate_tenant
130
+ # raise ArgumentError, "Tenant required" unless context[:tenant]
131
+ # end
133
132
 
134
- # def log_completion(result)
135
- # Rails.logger.info("Pipeline completed: #{result.success?}")
136
- # end
137
- end
133
+ # def log_completion(result)
134
+ # Rails.logger.info("Pipeline completed: #{result.success?}")
135
+ # end
138
136
  end
139
137
  end
@@ -1,21 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Base class for all image transformers in the application
4
- #
5
- # Inherits from RubyLLM::Agents::ImageTransformer and provides a common
6
- # foundation for custom image transformation classes.
7
- #
8
- # @example Creating a custom transformer
9
- # class AnimeTransformer < ApplicationImageTransformer
10
- # model "sdxl"
11
- # strength 0.8
12
- # template "anime style, studio ghibli, {prompt}"
13
- # end
14
- #
15
- class ApplicationImageTransformer < RubyLLM::Agents::ImageTransformer
16
- # Default configuration (can be overridden in subclasses)
17
- # model "sdxl"
18
- # size "1024x1024"
19
- # strength 0.75
20
- # preserve_composition true
3
+ module Images
4
+ # Base class for all image transformers in the application
5
+ #
6
+ # Inherits from RubyLLM::Agents::ImageTransformer and provides a common
7
+ # foundation for custom image transformation classes.
8
+ #
9
+ # @example Creating a custom transformer
10
+ # class AnimeTransformer < ApplicationImageTransformer
11
+ # model "sdxl"
12
+ # strength 0.8
13
+ # template "anime style, studio ghibli, {prompt}"
14
+ # end
15
+ #
16
+ class ApplicationImageTransformer < RubyLLM::Agents::ImageTransformer
17
+ # Default configuration (can be overridden in subclasses)
18
+ # model "sdxl"
19
+ # size "1024x1024"
20
+ # strength 0.75
21
+ # preserve_composition true
22
+ end
21
23
  end
@@ -1,20 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Base class for all image upscalers in the application
4
- #
5
- # Inherits from RubyLLM::Agents::ImageUpscaler and provides a common
6
- # foundation for custom image upscaling classes.
7
- #
8
- # @example Creating a custom upscaler
9
- # class PhotoUpscaler < ApplicationImageUpscaler
10
- # model "real-esrgan"
11
- # scale 4
12
- # face_enhance true
13
- # end
14
- #
15
- class ApplicationImageUpscaler < RubyLLM::Agents::ImageUpscaler
16
- # Default configuration (can be overridden in subclasses)
17
- # model "real-esrgan"
18
- # scale 4
19
- # face_enhance false
3
+ module Images
4
+ # Base class for all image upscalers in the application
5
+ #
6
+ # Inherits from RubyLLM::Agents::ImageUpscaler and provides a common
7
+ # foundation for custom image upscaling classes.
8
+ #
9
+ # @example Creating a custom upscaler
10
+ # class PhotoUpscaler < ApplicationImageUpscaler
11
+ # model "real-esrgan"
12
+ # scale 4
13
+ # face_enhance true
14
+ # end
15
+ #
16
+ class ApplicationImageUpscaler < RubyLLM::Agents::ImageUpscaler
17
+ # Default configuration (can be overridden in subclasses)
18
+ # model "real-esrgan"
19
+ # scale 4
20
+ # face_enhance false
21
+ end
20
22
  end
@@ -1,20 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Base class for all image variators in the application
4
- #
5
- # Inherits from RubyLLM::Agents::ImageVariator and provides a common
6
- # foundation for custom image variation classes.
7
- #
8
- # @example Creating a custom variator
9
- # class LogoVariator < ApplicationImageVariator
10
- # model "gpt-image-1"
11
- # size "1024x1024"
12
- # variation_strength 0.3
13
- # end
14
- #
15
- class ApplicationImageVariator < RubyLLM::Agents::ImageVariator
16
- # Default configuration (can be overridden in subclasses)
17
- # model "gpt-image-1"
18
- # size "1024x1024"
19
- # variation_strength 0.5
3
+ module Images
4
+ # Base class for all image variators in the application
5
+ #
6
+ # Inherits from RubyLLM::Agents::ImageVariator and provides a common
7
+ # foundation for custom image variation classes.
8
+ #
9
+ # @example Creating a custom variator
10
+ # class LogoVariator < ApplicationImageVariator
11
+ # model "gpt-image-1"
12
+ # size "1024x1024"
13
+ # variation_strength 0.3
14
+ # end
15
+ #
16
+ class ApplicationImageVariator < RubyLLM::Agents::ImageVariator
17
+ # Default configuration (can be overridden in subclasses)
18
+ # model "gpt-image-1"
19
+ # size "1024x1024"
20
+ # variation_strength 0.5
21
+ end
20
22
  end
@@ -1,49 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module <%= @root_namespace %>
4
- module Audio
5
- # ApplicationSpeaker - Base class for all speakers in this application
6
- #
7
- # All speakers inherit from this class. Configure shared settings here
8
- # that apply to all speakers, or override them per-speaker as needed.
9
- #
10
- # Example:
11
- # class NarratorSpeaker < ApplicationSpeaker
12
- # voice "nova"
13
- # speed 1.1
14
- # end
15
- #
16
- # Usage:
17
- # <%= @root_namespace %>::Audio::NarratorSpeaker.call(text: "Hello world")
18
- #
19
- class ApplicationSpeaker < RubyLLM::Agents::Speaker
20
- # ============================================
21
- # Shared Provider Configuration
22
- # ============================================
23
- # These settings are inherited by all speakers
3
+ module Audio
4
+ # ApplicationSpeaker - Base class for all speakers in this application
5
+ #
6
+ # All speakers inherit from this class. Configure shared settings here
7
+ # that apply to all speakers, or override them per-speaker as needed.
8
+ #
9
+ # Example:
10
+ # class NarratorSpeaker < ApplicationSpeaker
11
+ # voice "nova"
12
+ # speed 1.1
13
+ # end
14
+ #
15
+ # Usage:
16
+ # Audio::NarratorSpeaker.call(text: "Hello world")
17
+ #
18
+ class ApplicationSpeaker < RubyLLM::Agents::Speaker
19
+ # ============================================
20
+ # Shared Provider Configuration
21
+ # ============================================
22
+ # These settings are inherited by all speakers
24
23
 
25
- # provider :openai # TTS provider (:openai, :elevenlabs)
26
- # model "tts-1" # TTS model
27
- # voice "nova" # Default voice
28
- # speed 1.0 # Speech speed (0.25-4.0 for OpenAI)
29
- # output_format :mp3 # Output format (:mp3, :wav, :ogg, :flac)
24
+ # provider :openai # TTS provider (:openai, :elevenlabs)
25
+ # model "tts-1" # TTS model
26
+ # voice "nova" # Default voice
27
+ # speed 1.0 # Speech speed (0.25-4.0 for OpenAI)
28
+ # output_format :mp3 # Output format (:mp3, :wav, :ogg, :flac)
30
29
 
31
- # ============================================
32
- # Shared Caching
33
- # ============================================
34
- # Same text with same settings produces same audio, so caching is effective
30
+ # ============================================
31
+ # Shared Caching
32
+ # ============================================
33
+ # Same text with same settings produces same audio, so caching is effective
35
34
 
36
- # cache_for 7.days # Cache generated audio for a week
35
+ # cache_for 7.days # Cache generated audio for a week
37
36
 
38
- # ============================================
39
- # Shared Pronunciation Lexicon
40
- # ============================================
41
- # Define custom pronunciations for technical terms
37
+ # ============================================
38
+ # Shared Pronunciation Lexicon
39
+ # ============================================
40
+ # Define custom pronunciations for technical terms
42
41
 
43
- # lexicon do
44
- # pronounce 'RubyLLM', 'ruby L L M'
45
- # pronounce 'PostgreSQL', 'post-gres-Q-L'
46
- # end
47
- end
42
+ # lexicon do
43
+ # pronounce 'RubyLLM', 'ruby L L M'
44
+ # pronounce 'PostgreSQL', 'post-gres-Q-L'
45
+ # end
48
46
  end
49
47
  end
@@ -1,53 +1,51 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module <%= @root_namespace %>
4
- module Audio
5
- # ApplicationTranscriber - Base class for all transcribers in this application
6
- #
7
- # All transcribers inherit from this class. Configure shared settings here
8
- # that apply to all transcribers, or override them per-transcriber as needed.
9
- #
10
- # Example:
11
- # class MeetingTranscriber < ApplicationTranscriber
12
- # language "en"
13
- #
14
- # def prompt
15
- # "Business meeting discussion about quarterly results"
16
- # end
17
- # end
18
- #
19
- # Usage:
20
- # <%= @root_namespace %>::Audio::MeetingTranscriber.call(audio: "meeting.mp3")
21
- #
22
- class ApplicationTranscriber < RubyLLM::Agents::Transcriber
23
- # ============================================
24
- # Shared Model Configuration
25
- # ============================================
26
- # These settings are inherited by all transcribers
3
+ module Audio
4
+ # ApplicationTranscriber - Base class for all transcribers in this application
5
+ #
6
+ # All transcribers inherit from this class. Configure shared settings here
7
+ # that apply to all transcribers, or override them per-transcriber as needed.
8
+ #
9
+ # Example:
10
+ # class MeetingTranscriber < ApplicationTranscriber
11
+ # language "en"
12
+ #
13
+ # def prompt
14
+ # "Business meeting discussion about quarterly results"
15
+ # end
16
+ # end
17
+ #
18
+ # Usage:
19
+ # Audio::MeetingTranscriber.call(audio: "meeting.mp3")
20
+ #
21
+ class ApplicationTranscriber < RubyLLM::Agents::Transcriber
22
+ # ============================================
23
+ # Shared Model Configuration
24
+ # ============================================
25
+ # These settings are inherited by all transcribers
27
26
 
28
- # model "whisper-1" # Default transcription model
29
- # language "en" # Default language (nil = auto-detect)
30
- # output_format :text # Output format (:text, :srt, :vtt, :json)
31
- # include_timestamps :segment # Timestamp granularity (:none, :segment, :word)
27
+ # model "whisper-1" # Default transcription model
28
+ # language "en" # Default language (nil = auto-detect)
29
+ # output_format :text # Output format (:text, :srt, :vtt, :json)
30
+ # include_timestamps :segment # Timestamp granularity (:none, :segment, :word)
32
31
 
33
- # ============================================
34
- # Shared Caching
35
- # ============================================
36
- # Same audio always produces same transcription, so caching is effective
32
+ # ============================================
33
+ # Shared Caching
34
+ # ============================================
35
+ # Same audio always produces same transcription, so caching is effective
37
36
 
38
- # cache_for 30.days # Cache transcriptions for 30 days
37
+ # cache_for 30.days # Cache transcriptions for 30 days
39
38
 
40
- # ============================================
41
- # Shared Post-processing
42
- # ============================================
43
- # Override in subclass for custom text cleanup
39
+ # ============================================
40
+ # Shared Post-processing
41
+ # ============================================
42
+ # Override in subclass for custom text cleanup
44
43
 
45
- # def postprocess_text(text)
46
- # text
47
- # .gsub(/\bum\b/i, '') # Remove filler words
48
- # .gsub(/\buh\b/i, '')
49
- # .squeeze(' ') # Remove extra spaces
50
- # end
51
- end
44
+ # def postprocess_text(text)
45
+ # text
46
+ # .gsub(/\bum\b/i, '') # Remove filler words
47
+ # .gsub(/\buh\b/i, '')
48
+ # .squeeze(' ') # Remove extra spaces
49
+ # end
52
50
  end
53
51
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # ApplicationWorkflow - Base class for all workflows in this application
4
+ #
5
+ # All workflows inherit from this class. Configure shared settings here
6
+ # that apply to all workflows, or override them per-workflow as needed.
7
+ #
8
+ # Workflows compose multiple agents into pipelines, parallel executions,
9
+ # or conditional routing flows.
10
+ #
11
+ # Example:
12
+ # class ContentPipelineWorkflow < ApplicationWorkflow
13
+ # description "Process and publish content"
14
+ #
15
+ # step :moderate, agent: Moderators::ContentModerator
16
+ # step :generate_image, agent: Images::ProductGenerator
17
+ # step :embed, agent: Embedders::SemanticEmbedder
18
+ # end
19
+ #
20
+ # Usage:
21
+ # ContentPipelineWorkflow.call(content: "...")
22
+ #
23
+ class ApplicationWorkflow < RubyLLM::Agents::Workflow::Orchestrator
24
+ # ============================================
25
+ # Shared Workflow Configuration
26
+ # ============================================
27
+
28
+ # Default timeout for entire workflow
29
+ # total_timeout 120
30
+
31
+ # Budget tracking
32
+ # budget_limit 1.0 # Maximum spend in dollars
33
+
34
+ # ============================================
35
+ # Shared Helper Methods
36
+ # ============================================
37
+
38
+ # Example: Common error handling
39
+ # def on_step_error(step_name, error)
40
+ # Rails.logger.error "Workflow step #{step_name} failed: #{error.message}"
41
+ # # Optionally notify monitoring
42
+ # end
43
+
44
+ # Example: Common success callback
45
+ # def on_complete(result)
46
+ # Rails.logger.info "Workflow completed successfully"
47
+ # end
48
+ end