Class: Ace::Task::Molecules::TaskPlanGenerator
- Inherits:
-
Object
- Object
- Ace::Task::Molecules::TaskPlanGenerator
- Defined in:
- lib/ace/task/molecules/task_plan_generator.rb
Overview
Generates implementation plans from task specs using ace-llm backend.
Constant Summary collapse
- DEFAULT_TIMEOUT =
600
Instance Attribute Summary collapse
-
#prompt_paths ⇒ Object
readonly
After generate(), contains { system_file:, prompt_file: } if file-based prompts were used.
Instance Method Summary collapse
- #generate(task:, context_files:, cache_dir: nil) ⇒ Object
-
#initialize(model:, timeout: DEFAULT_TIMEOUT, client: nil, cli_args: nil) ⇒ TaskPlanGenerator
constructor
A new instance of TaskPlanGenerator.
Constructor Details
#initialize(model:, timeout: DEFAULT_TIMEOUT, client: nil, cli_args: nil) ⇒ TaskPlanGenerator
Returns a new instance of TaskPlanGenerator.
17 18 19 20 21 22 23 |
# File 'lib/ace/task/molecules/task_plan_generator.rb', line 17 def initialize(model:, timeout: DEFAULT_TIMEOUT, client: nil, cli_args: nil) @model = model @timeout = timeout @client = client @cli_args = cli_args @prompt_paths = nil end |
Instance Attribute Details
#prompt_paths ⇒ Object (readonly)
After generate(), contains { system_file:, prompt_file: } if file-based prompts were used
15 16 17 |
# File 'lib/ace/task/molecules/task_plan_generator.rb', line 15 def prompt_paths @prompt_paths end |
Instance Method Details
#generate(task:, context_files:, cache_dir: nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ace/task/molecules/task_plan_generator.rb', line 25 def generate(task:, context_files:, cache_dir: nil) if cache_dir generate_with_file_prompts(task, cache_dir) else generate_with_inline_prompt(task, context_files) end rescue LoadError => e raise Ace::Support::Cli::Error.new( "Plan generation backend unavailable: #{e.}. " \ "Ensure ace-llm is installed/configured, or provide --model." ) rescue Ace::Support::Cli::Error raise rescue StandardError => e raise unless recoverable_query_error?(e) raise Ace::Support::Cli::Error.new( "Plan generation failed: #{e.}. Retry with --refresh or choose a working --model." ) end |