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.
- checksums.yaml +4 -4
- data/app/controllers/concerns/ruby_llm/agents/paginatable.rb +9 -3
- data/app/controllers/concerns/ruby_llm/agents/sortable.rb +58 -0
- data/app/controllers/ruby_llm/agents/agents_controller.rb +59 -16
- data/app/controllers/ruby_llm/agents/dashboard_controller.rb +144 -20
- data/app/controllers/ruby_llm/agents/executions_controller.rb +13 -16
- data/app/controllers/ruby_llm/agents/workflows_controller.rb +279 -90
- data/app/helpers/ruby_llm/agents/application_helper.rb +100 -0
- data/app/mailers/ruby_llm/agents/alert_mailer.rb +84 -0
- data/app/mailers/ruby_llm/agents/application_mailer.rb +28 -0
- data/app/models/ruby_llm/agents/execution/analytics.rb +170 -20
- data/app/models/ruby_llm/agents/execution/scopes.rb +0 -31
- data/app/models/ruby_llm/agents/execution/workflow.rb +0 -129
- data/app/models/ruby_llm/agents/execution.rb +50 -14
- data/app/models/ruby_llm/agents/tenant/budgetable.rb +277 -0
- data/app/models/ruby_llm/agents/tenant/configurable.rb +135 -0
- data/app/models/ruby_llm/agents/tenant/trackable.rb +310 -0
- data/app/models/ruby_llm/agents/tenant.rb +146 -0
- data/app/models/ruby_llm/agents/tenant_budget.rb +12 -253
- data/app/services/ruby_llm/agents/agent_registry.rb +18 -12
- data/app/views/layouts/ruby_llm/agents/application.html.erb +72 -76
- data/app/views/ruby_llm/agents/agents/_agent.html.erb +0 -12
- data/app/views/ruby_llm/agents/agents/_sortable_header.html.erb +56 -0
- data/app/views/ruby_llm/agents/agents/_workflow.html.erb +5 -15
- data/app/views/ruby_llm/agents/agents/index.html.erb +271 -100
- data/app/views/ruby_llm/agents/agents/show.html.erb +1 -0
- data/app/views/ruby_llm/agents/alert_mailer/alert_notification.html.erb +107 -0
- data/app/views/ruby_llm/agents/alert_mailer/alert_notification.text.erb +18 -0
- data/app/views/ruby_llm/agents/api_configurations/show.html.erb +4 -1
- data/app/views/ruby_llm/agents/dashboard/_agent_comparison.html.erb +66 -359
- data/app/views/ruby_llm/agents/dashboard/_model_comparison.html.erb +56 -0
- data/app/views/ruby_llm/agents/dashboard/_model_cost_breakdown.html.erb +115 -0
- data/app/views/ruby_llm/agents/dashboard/_now_strip.html.erb +35 -60
- data/app/views/ruby_llm/agents/dashboard/_top_errors.html.erb +17 -6
- data/app/views/ruby_llm/agents/dashboard/index.html.erb +373 -72
- data/app/views/ruby_llm/agents/executions/_execution.html.erb +0 -1
- data/app/views/ruby_llm/agents/executions/_filters.html.erb +51 -39
- data/app/views/ruby_llm/agents/executions/_list.html.erb +53 -195
- data/app/views/ruby_llm/agents/executions/_workflow_summary.html.erb +5 -20
- data/app/views/ruby_llm/agents/executions/index.html.erb +7 -83
- data/app/views/ruby_llm/agents/executions/show.html.erb +10 -20
- data/app/views/ruby_llm/agents/shared/_agent_type_badge.html.erb +2 -1
- data/app/views/ruby_llm/agents/shared/_doc_link.html.erb +12 -0
- data/app/views/ruby_llm/agents/shared/_executions_table.html.erb +3 -15
- data/app/views/ruby_llm/agents/shared/_filter_dropdown.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_select_dropdown.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_sortable_header.html.erb +53 -0
- data/app/views/ruby_llm/agents/shared/_status_badge.html.erb +7 -0
- data/app/views/ruby_llm/agents/shared/_status_dot.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_workflow_type_badge.html.erb +9 -35
- data/app/views/ruby_llm/agents/system_config/show.html.erb +4 -1
- data/app/views/ruby_llm/agents/tenants/index.html.erb +4 -1
- data/app/views/ruby_llm/agents/workflows/_step_performance.html.erb +7 -15
- data/app/views/ruby_llm/agents/workflows/_structure_dsl.html.erb +539 -0
- data/app/views/ruby_llm/agents/workflows/_workflow_diagram.html.erb +920 -0
- data/app/views/ruby_llm/agents/workflows/index.html.erb +179 -0
- data/app/views/ruby_llm/agents/workflows/show.html.erb +164 -139
- data/config/routes.rb +1 -1
- data/lib/generators/ruby_llm_agents/agent_generator.rb +6 -36
- data/lib/generators/ruby_llm_agents/background_remover_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/embedder_generator.rb +5 -38
- data/lib/generators/ruby_llm_agents/image_analyzer_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/image_editor_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/image_generator_generator.rb +8 -41
- data/lib/generators/ruby_llm_agents/image_pipeline_generator.rb +18 -46
- data/lib/generators/ruby_llm_agents/image_transformer_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/image_upscaler_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/image_variator_generator.rb +7 -37
- data/lib/generators/ruby_llm_agents/install_generator.rb +33 -56
- data/lib/generators/ruby_llm_agents/migrate_structure_generator.rb +480 -0
- data/lib/generators/ruby_llm_agents/multi_tenancy_generator.rb +42 -22
- data/lib/generators/ruby_llm_agents/restructure_generator.rb +2 -2
- data/lib/generators/ruby_llm_agents/speaker_generator.rb +8 -39
- data/lib/generators/ruby_llm_agents/templates/add_tenant_to_executions_migration.rb.tt +13 -2
- data/lib/generators/ruby_llm_agents/templates/agent.rb.tt +5 -8
- data/lib/generators/ruby_llm_agents/templates/application_agent.rb.tt +40 -42
- data/lib/generators/ruby_llm_agents/templates/application_background_remover.rb.tt +20 -22
- data/lib/generators/ruby_llm_agents/templates/application_embedder.rb.tt +24 -26
- data/lib/generators/ruby_llm_agents/templates/application_image_analyzer.rb.tt +20 -22
- data/lib/generators/ruby_llm_agents/templates/application_image_editor.rb.tt +19 -17
- data/lib/generators/ruby_llm_agents/templates/application_image_generator.rb.tt +31 -33
- data/lib/generators/ruby_llm_agents/templates/application_image_pipeline.rb.tt +125 -127
- data/lib/generators/ruby_llm_agents/templates/application_image_transformer.rb.tt +20 -18
- data/lib/generators/ruby_llm_agents/templates/application_image_upscaler.rb.tt +19 -17
- data/lib/generators/ruby_llm_agents/templates/application_image_variator.rb.tt +19 -17
- data/lib/generators/ruby_llm_agents/templates/application_speaker.rb.tt +38 -40
- data/lib/generators/ruby_llm_agents/templates/application_transcriber.rb.tt +42 -44
- data/lib/generators/ruby_llm_agents/templates/application_workflow.rb.tt +48 -0
- data/lib/generators/ruby_llm_agents/templates/background_remover.rb.tt +19 -21
- data/lib/generators/ruby_llm_agents/templates/create_tenant_budgets_migration.rb.tt +11 -0
- data/lib/generators/ruby_llm_agents/templates/create_tenants_migration.rb.tt +72 -0
- data/lib/generators/ruby_llm_agents/templates/embedder.rb.tt +19 -21
- data/lib/generators/ruby_llm_agents/templates/image_analyzer.rb.tt +20 -22
- data/lib/generators/ruby_llm_agents/templates/image_editor.rb.tt +15 -17
- data/lib/generators/ruby_llm_agents/templates/image_generator.rb.tt +25 -27
- data/lib/generators/ruby_llm_agents/templates/image_pipeline.rb.tt +19 -21
- data/lib/generators/ruby_llm_agents/templates/image_transformer.rb.tt +20 -22
- data/lib/generators/ruby_llm_agents/templates/image_upscaler.rb.tt +17 -19
- data/lib/generators/ruby_llm_agents/templates/image_variator.rb.tt +15 -17
- data/lib/generators/ruby_llm_agents/templates/rename_tenant_budgets_to_tenants_migration.rb.tt +34 -0
- data/lib/generators/ruby_llm_agents/templates/skills/AGENTS.md.tt +87 -24
- data/lib/generators/ruby_llm_agents/templates/skills/BACKGROUND_REMOVERS.md.tt +21 -27
- data/lib/generators/ruby_llm_agents/templates/skills/EMBEDDERS.md.tt +46 -54
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_ANALYZERS.md.tt +31 -39
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_EDITORS.md.tt +22 -28
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_GENERATORS.md.tt +53 -63
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_PIPELINES.md.tt +46 -56
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_TRANSFORMERS.md.tt +23 -31
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_UPSCALERS.md.tt +22 -30
- data/lib/generators/ruby_llm_agents/templates/skills/IMAGE_VARIATORS.md.tt +23 -31
- data/lib/generators/ruby_llm_agents/templates/skills/SPEAKERS.md.tt +38 -46
- data/lib/generators/ruby_llm_agents/templates/skills/TOOLS.md.tt +7 -7
- data/lib/generators/ruby_llm_agents/templates/skills/TRANSCRIBERS.md.tt +59 -71
- data/lib/generators/ruby_llm_agents/templates/skills/WORKFLOWS.md.tt +274 -23
- data/lib/generators/ruby_llm_agents/templates/speaker.rb.tt +29 -31
- data/lib/generators/ruby_llm_agents/templates/transcriber.rb.tt +28 -30
- data/lib/generators/ruby_llm_agents/transcriber_generator.rb +10 -43
- data/lib/generators/ruby_llm_agents/upgrade_generator.rb +26 -0
- data/lib/ruby_llm/agents/core/configuration.rb +55 -43
- data/lib/ruby_llm/agents/core/llm_tenant.rb +60 -60
- data/lib/ruby_llm/agents/core/version.rb +1 -1
- data/lib/ruby_llm/agents/infrastructure/alert_manager.rb +26 -0
- data/lib/ruby_llm/agents/infrastructure/budget/config_resolver.rb +4 -2
- data/lib/ruby_llm/agents/pipeline.rb +69 -0
- data/lib/ruby_llm/agents/workflow/approval.rb +205 -0
- data/lib/ruby_llm/agents/workflow/approval_store.rb +179 -0
- data/lib/ruby_llm/agents/workflow/dsl/executor.rb +467 -0
- data/lib/ruby_llm/agents/workflow/dsl/input_schema.rb +244 -0
- data/lib/ruby_llm/agents/workflow/dsl/iteration_executor.rb +289 -0
- data/lib/ruby_llm/agents/workflow/dsl/parallel_group.rb +107 -0
- data/lib/ruby_llm/agents/workflow/dsl/route_builder.rb +150 -0
- data/lib/ruby_llm/agents/workflow/dsl/schedule_helpers.rb +187 -0
- data/lib/ruby_llm/agents/workflow/dsl/step_config.rb +352 -0
- data/lib/ruby_llm/agents/workflow/dsl/step_executor.rb +415 -0
- data/lib/ruby_llm/agents/workflow/dsl/wait_config.rb +257 -0
- data/lib/ruby_llm/agents/workflow/dsl/wait_executor.rb +317 -0
- data/lib/ruby_llm/agents/workflow/dsl.rb +576 -0
- data/lib/ruby_llm/agents/workflow/instrumentation.rb +2 -7
- data/lib/ruby_llm/agents/workflow/notifiers/base.rb +117 -0
- data/lib/ruby_llm/agents/workflow/notifiers/email.rb +117 -0
- data/lib/ruby_llm/agents/workflow/notifiers/slack.rb +180 -0
- data/lib/ruby_llm/agents/workflow/notifiers/webhook.rb +121 -0
- data/lib/ruby_llm/agents/workflow/notifiers.rb +70 -0
- data/lib/ruby_llm/agents/workflow/orchestrator.rb +190 -23
- data/lib/ruby_llm/agents/workflow/result.rb +202 -0
- data/lib/ruby_llm/agents/workflow/throttle_manager.rb +206 -0
- data/lib/ruby_llm/agents/workflow/wait_result.rb +213 -0
- metadata +43 -6
- data/app/views/ruby_llm/agents/dashboard/_execution_item.html.erb +0 -66
- data/lib/ruby_llm/agents/workflow/parallel.rb +0 -299
- data/lib/ruby_llm/agents/workflow/pipeline.rb +0 -306
- data/lib/ruby_llm/agents/workflow/router.rb +0 -429
|
@@ -9,10 +9,9 @@ module RubyLlmAgents
|
|
|
9
9
|
# rails generate ruby_llm_agents:image_upscaler Photo
|
|
10
10
|
# rails generate ruby_llm_agents:image_upscaler Portrait --model real-esrgan --scale 4
|
|
11
11
|
# rails generate ruby_llm_agents:image_upscaler Face --face_enhance
|
|
12
|
-
# rails generate ruby_llm_agents:image_upscaler Photo --root=ai
|
|
13
12
|
#
|
|
14
13
|
# This will create:
|
|
15
|
-
# - app/
|
|
14
|
+
# - app/agents/images/photo_upscaler.rb
|
|
16
15
|
#
|
|
17
16
|
class ImageUpscalerGenerator < ::Rails::Generators::NamedBase
|
|
18
17
|
source_root File.expand_path("templates", __dir__)
|
|
@@ -25,46 +24,34 @@ module RubyLlmAgents
|
|
|
25
24
|
desc: "Enable face enhancement"
|
|
26
25
|
class_option :cache, type: :string, default: nil,
|
|
27
26
|
desc: "Cache TTL (e.g., '1.hour', '1.day')"
|
|
28
|
-
class_option :root,
|
|
29
|
-
type: :string,
|
|
30
|
-
default: nil,
|
|
31
|
-
desc: "Root directory name (default: uses config or 'llm')"
|
|
32
|
-
class_option :namespace,
|
|
33
|
-
type: :string,
|
|
34
|
-
default: nil,
|
|
35
|
-
desc: "Root namespace (default: camelized root or config)"
|
|
36
27
|
|
|
37
28
|
def ensure_base_class_and_skill_file
|
|
38
|
-
|
|
39
|
-
@image_namespace = "#{root_namespace}::Image"
|
|
40
|
-
upscalers_dir = "app/#{root_directory}/image/upscalers"
|
|
29
|
+
images_dir = "app/agents/images"
|
|
41
30
|
|
|
42
31
|
# Create directory if needed
|
|
43
|
-
empty_directory
|
|
32
|
+
empty_directory images_dir
|
|
44
33
|
|
|
45
34
|
# Create base class if it doesn't exist
|
|
46
|
-
base_class_path = "#{
|
|
35
|
+
base_class_path = "#{images_dir}/application_image_upscaler.rb"
|
|
47
36
|
unless File.exist?(File.join(destination_root, base_class_path))
|
|
48
37
|
template "application_image_upscaler.rb.tt", base_class_path
|
|
49
38
|
end
|
|
50
39
|
|
|
51
40
|
# Create skill file if it doesn't exist
|
|
52
|
-
skill_file_path = "#{
|
|
41
|
+
skill_file_path = "#{images_dir}/IMAGE_UPSCALERS.md"
|
|
53
42
|
unless File.exist?(File.join(destination_root, skill_file_path))
|
|
54
43
|
template "skills/IMAGE_UPSCALERS.md.tt", skill_file_path
|
|
55
44
|
end
|
|
56
45
|
end
|
|
57
46
|
|
|
58
47
|
def create_image_upscaler_file
|
|
59
|
-
@root_namespace = root_namespace
|
|
60
|
-
@image_namespace = "#{root_namespace}::Image"
|
|
61
48
|
upscaler_path = name.underscore
|
|
62
|
-
template "image_upscaler.rb.tt", "app
|
|
49
|
+
template "image_upscaler.rb.tt", "app/agents/images/#{upscaler_path}_upscaler.rb"
|
|
63
50
|
end
|
|
64
51
|
|
|
65
52
|
def show_usage
|
|
66
53
|
upscaler_class_name = name.split("/").map(&:camelize).join("::")
|
|
67
|
-
full_class_name = "
|
|
54
|
+
full_class_name = "Images::#{upscaler_class_name}Upscaler"
|
|
68
55
|
say ""
|
|
69
56
|
say "Image upscaler #{full_class_name} created!", :green
|
|
70
57
|
say ""
|
|
@@ -82,22 +69,5 @@ module RubyLlmAgents
|
|
|
82
69
|
say " )"
|
|
83
70
|
say ""
|
|
84
71
|
end
|
|
85
|
-
|
|
86
|
-
private
|
|
87
|
-
|
|
88
|
-
def root_directory
|
|
89
|
-
@root_directory ||= options[:root] || RubyLLM::Agents.configuration.root_directory
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def root_namespace
|
|
93
|
-
@root_namespace ||= options[:namespace] || camelize(root_directory)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def camelize(str)
|
|
97
|
-
return "AI" if str.downcase == "ai"
|
|
98
|
-
return "ML" if str.downcase == "ml"
|
|
99
|
-
return "LLM" if str.downcase == "llm"
|
|
100
|
-
str.split(/[-_]/).map(&:capitalize).join
|
|
101
|
-
end
|
|
102
72
|
end
|
|
103
73
|
end
|
|
@@ -9,10 +9,9 @@ module RubyLlmAgents
|
|
|
9
9
|
# rails generate ruby_llm_agents:image_variator Logo
|
|
10
10
|
# rails generate ruby_llm_agents:image_variator Product --model gpt-image-1 --size 1024x1024
|
|
11
11
|
# rails generate ruby_llm_agents:image_variator Avatar --variation_strength 0.3
|
|
12
|
-
# rails generate ruby_llm_agents:image_variator Logo --root=ai
|
|
13
12
|
#
|
|
14
13
|
# This will create:
|
|
15
|
-
# - app/
|
|
14
|
+
# - app/agents/images/logo_variator.rb
|
|
16
15
|
#
|
|
17
16
|
class ImageVariatorGenerator < ::Rails::Generators::NamedBase
|
|
18
17
|
source_root File.expand_path("templates", __dir__)
|
|
@@ -25,46 +24,34 @@ module RubyLlmAgents
|
|
|
25
24
|
desc: "Variation strength (0.0-1.0)"
|
|
26
25
|
class_option :cache, type: :string, default: nil,
|
|
27
26
|
desc: "Cache TTL (e.g., '1.hour', '1.day')"
|
|
28
|
-
class_option :root,
|
|
29
|
-
type: :string,
|
|
30
|
-
default: nil,
|
|
31
|
-
desc: "Root directory name (default: uses config or 'llm')"
|
|
32
|
-
class_option :namespace,
|
|
33
|
-
type: :string,
|
|
34
|
-
default: nil,
|
|
35
|
-
desc: "Root namespace (default: camelized root or config)"
|
|
36
27
|
|
|
37
28
|
def ensure_base_class_and_skill_file
|
|
38
|
-
|
|
39
|
-
@image_namespace = "#{root_namespace}::Image"
|
|
40
|
-
variators_dir = "app/#{root_directory}/image/variators"
|
|
29
|
+
images_dir = "app/agents/images"
|
|
41
30
|
|
|
42
31
|
# Create directory if needed
|
|
43
|
-
empty_directory
|
|
32
|
+
empty_directory images_dir
|
|
44
33
|
|
|
45
34
|
# Create base class if it doesn't exist
|
|
46
|
-
base_class_path = "#{
|
|
35
|
+
base_class_path = "#{images_dir}/application_image_variator.rb"
|
|
47
36
|
unless File.exist?(File.join(destination_root, base_class_path))
|
|
48
37
|
template "application_image_variator.rb.tt", base_class_path
|
|
49
38
|
end
|
|
50
39
|
|
|
51
40
|
# Create skill file if it doesn't exist
|
|
52
|
-
skill_file_path = "#{
|
|
41
|
+
skill_file_path = "#{images_dir}/IMAGE_VARIATORS.md"
|
|
53
42
|
unless File.exist?(File.join(destination_root, skill_file_path))
|
|
54
43
|
template "skills/IMAGE_VARIATORS.md.tt", skill_file_path
|
|
55
44
|
end
|
|
56
45
|
end
|
|
57
46
|
|
|
58
47
|
def create_image_variator_file
|
|
59
|
-
@root_namespace = root_namespace
|
|
60
|
-
@image_namespace = "#{root_namespace}::Image"
|
|
61
48
|
variator_path = name.underscore
|
|
62
|
-
template "image_variator.rb.tt", "app
|
|
49
|
+
template "image_variator.rb.tt", "app/agents/images/#{variator_path}_variator.rb"
|
|
63
50
|
end
|
|
64
51
|
|
|
65
52
|
def show_usage
|
|
66
53
|
variator_class_name = name.split("/").map(&:camelize).join("::")
|
|
67
|
-
full_class_name = "
|
|
54
|
+
full_class_name = "Images::#{variator_class_name}Variator"
|
|
68
55
|
say ""
|
|
69
56
|
say "Image variator #{full_class_name} created!", :green
|
|
70
57
|
say ""
|
|
@@ -81,22 +68,5 @@ module RubyLlmAgents
|
|
|
81
68
|
say " )"
|
|
82
69
|
say ""
|
|
83
70
|
end
|
|
84
|
-
|
|
85
|
-
private
|
|
86
|
-
|
|
87
|
-
def root_directory
|
|
88
|
-
@root_directory ||= options[:root] || RubyLLM::Agents.configuration.root_directory
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def root_namespace
|
|
92
|
-
@root_namespace ||= options[:namespace] || camelize(root_directory)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def camelize(str)
|
|
96
|
-
return "AI" if str.downcase == "ai"
|
|
97
|
-
return "ML" if str.downcase == "ml"
|
|
98
|
-
return "LLM" if str.downcase == "llm"
|
|
99
|
-
str.split(/[-_]/).map(&:capitalize).join
|
|
100
|
-
end
|
|
101
71
|
end
|
|
102
72
|
end
|
|
@@ -8,13 +8,13 @@ module RubyLlmAgents
|
|
|
8
8
|
#
|
|
9
9
|
# Usage:
|
|
10
10
|
# rails generate ruby_llm_agents:install
|
|
11
|
-
# rails generate ruby_llm_agents:install --root=ai
|
|
12
11
|
#
|
|
13
12
|
# This will:
|
|
14
13
|
# - Create the migration for ruby_llm_agents_executions table
|
|
15
14
|
# - Create the initializer at config/initializers/ruby_llm_agents.rb
|
|
16
|
-
# - Create app/
|
|
17
|
-
# - Create app/
|
|
15
|
+
# - Create app/agents/application_agent.rb base class
|
|
16
|
+
# - Create app/agents/concerns/ directory
|
|
17
|
+
# - Create app/workflows/application_workflow.rb base class
|
|
18
18
|
# - Optionally mount the dashboard engine in routes
|
|
19
19
|
#
|
|
20
20
|
class InstallGenerator < ::Rails::Generators::Base
|
|
@@ -28,14 +28,6 @@ module RubyLlmAgents
|
|
|
28
28
|
desc: "Skip generating the initializer file"
|
|
29
29
|
class_option :mount_dashboard, type: :boolean, default: true,
|
|
30
30
|
desc: "Mount the dashboard engine in routes"
|
|
31
|
-
class_option :root,
|
|
32
|
-
type: :string,
|
|
33
|
-
default: nil,
|
|
34
|
-
desc: "Root directory name (default: uses config or 'llm')"
|
|
35
|
-
class_option :namespace,
|
|
36
|
-
type: :string,
|
|
37
|
-
default: nil,
|
|
38
|
-
desc: "Root namespace (default: camelized root or config)"
|
|
39
31
|
|
|
40
32
|
def create_migration_file
|
|
41
33
|
return if options[:skip_migration]
|
|
@@ -53,43 +45,38 @@ module RubyLlmAgents
|
|
|
53
45
|
end
|
|
54
46
|
|
|
55
47
|
def create_directory_structure
|
|
56
|
-
say_status :create, "
|
|
48
|
+
say_status :create, "agents/ directory structure", :green
|
|
57
49
|
|
|
58
|
-
# Create agents directory
|
|
59
|
-
empty_directory "app
|
|
50
|
+
# Create agents directory and subdirectories
|
|
51
|
+
empty_directory "app/agents"
|
|
52
|
+
empty_directory "app/agents/concerns"
|
|
60
53
|
|
|
61
|
-
# Create
|
|
62
|
-
empty_directory "app
|
|
54
|
+
# Create workflows directory
|
|
55
|
+
empty_directory "app/workflows"
|
|
56
|
+
|
|
57
|
+
# Create tools directory
|
|
58
|
+
empty_directory "app/tools"
|
|
63
59
|
end
|
|
64
60
|
|
|
65
61
|
def create_application_agent
|
|
66
|
-
|
|
67
|
-
template "application_agent.rb.tt", "app/#{root_directory}/agents/application_agent.rb"
|
|
62
|
+
template "application_agent.rb.tt", "app/agents/application_agent.rb"
|
|
68
63
|
end
|
|
69
64
|
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
@text_namespace = "#{root_namespace}::Text"
|
|
73
|
-
template "application_embedder.rb.tt", "app/#{root_directory}/text/embedders/application_embedder.rb"
|
|
65
|
+
def create_application_workflow
|
|
66
|
+
template "application_workflow.rb.tt", "app/workflows/application_workflow.rb"
|
|
74
67
|
end
|
|
75
68
|
|
|
76
69
|
def create_skill_files
|
|
77
|
-
@root_namespace = root_namespace
|
|
78
70
|
say_status :create, "skill documentation files", :green
|
|
79
71
|
|
|
80
72
|
# Create agents skill file
|
|
81
|
-
template "skills/AGENTS.md.tt", "app
|
|
82
|
-
|
|
83
|
-
# Create embedders skill file
|
|
84
|
-
template "skills/EMBEDDERS.md.tt", "app/#{root_directory}/text/embedders/EMBEDDERS.md"
|
|
73
|
+
template "skills/AGENTS.md.tt", "app/agents/AGENTS.md"
|
|
85
74
|
|
|
86
|
-
# Create
|
|
87
|
-
|
|
88
|
-
template "skills/TOOLS.md.tt", "app/#{root_directory}/tools/TOOLS.md"
|
|
75
|
+
# Create workflows skill file
|
|
76
|
+
template "skills/WORKFLOWS.md.tt", "app/workflows/WORKFLOWS.md"
|
|
89
77
|
|
|
90
|
-
# Create
|
|
91
|
-
|
|
92
|
-
template "skills/WORKFLOWS.md.tt", "app/#{root_directory}/workflows/WORKFLOWS.md"
|
|
78
|
+
# Create tools skill file
|
|
79
|
+
template "skills/TOOLS.md.tt", "app/tools/TOOLS.md"
|
|
93
80
|
end
|
|
94
81
|
|
|
95
82
|
def mount_dashboard_engine
|
|
@@ -112,28 +99,30 @@ module RubyLlmAgents
|
|
|
112
99
|
say "RubyLLM::Agents has been installed!", :green
|
|
113
100
|
say ""
|
|
114
101
|
say "Directory structure created:"
|
|
115
|
-
say " app
|
|
102
|
+
say " app/"
|
|
116
103
|
say " ├── agents/"
|
|
117
104
|
say " │ ├── application_agent.rb"
|
|
105
|
+
say " │ ├── concerns/"
|
|
118
106
|
say " │ └── AGENTS.md"
|
|
119
|
-
say " ├──
|
|
120
|
-
say " │
|
|
121
|
-
say " │
|
|
122
|
-
say "
|
|
123
|
-
say "
|
|
124
|
-
say " │ └── TOOLS.md"
|
|
125
|
-
say " └── workflows/"
|
|
126
|
-
say " └── WORKFLOWS.md"
|
|
107
|
+
say " ├── workflows/"
|
|
108
|
+
say " │ ├── application_workflow.rb"
|
|
109
|
+
say " │ └── WORKFLOWS.md"
|
|
110
|
+
say " └── tools/"
|
|
111
|
+
say " └── TOOLS.md"
|
|
127
112
|
say ""
|
|
128
113
|
say "Skill files (*.md) help AI coding assistants understand how to use this gem."
|
|
129
114
|
say ""
|
|
130
|
-
say "Namespace: #{root_namespace}::"
|
|
131
|
-
say ""
|
|
132
115
|
say "Next steps:"
|
|
133
116
|
say " 1. Run migrations: rails db:migrate"
|
|
134
117
|
say " 2. Generate an agent: rails generate ruby_llm_agents:agent MyAgent query:required"
|
|
135
118
|
say " 3. Access the dashboard at: /agents"
|
|
136
119
|
say ""
|
|
120
|
+
say "Generator commands:"
|
|
121
|
+
say " rails generate ruby_llm_agents:agent CustomerSupport query:required"
|
|
122
|
+
say " rails generate ruby_llm_agents:image_generator Product"
|
|
123
|
+
say " rails generate ruby_llm_agents:transcriber Meeting"
|
|
124
|
+
say " rails generate ruby_llm_agents:embedder Semantic"
|
|
125
|
+
say ""
|
|
137
126
|
end
|
|
138
127
|
|
|
139
128
|
private
|
|
@@ -145,17 +134,5 @@ module RubyLlmAgents
|
|
|
145
134
|
def db_migrate_path
|
|
146
135
|
"db/migrate"
|
|
147
136
|
end
|
|
148
|
-
|
|
149
|
-
def root_directory
|
|
150
|
-
@root_directory ||= options[:root] || RubyLLM::Agents.configuration.root_directory
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def root_namespace
|
|
154
|
-
@root_namespace ||= options[:namespace] || camelize(root_directory)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def camelize(str)
|
|
158
|
-
str.split(/[-_]/).map(&:capitalize).join
|
|
159
|
-
end
|
|
160
137
|
end
|
|
161
138
|
end
|