Class: RosettAi::Workflow::Steps::PromptStep
- Inherits:
-
Object
- Object
- RosettAi::Workflow::Steps::PromptStep
- Defined in:
- lib/rosett_ai/workflow/steps/prompt_step.rb
Overview
Sends a prompt to an AI engine and captures the response.
Requires network connectivity unless stubbed. Currently a stub implementation that records the prompt text — engine integration will be wired when MCP/engine APIs are available.
Instance Method Summary collapse
-
#describe ⇒ String
Step description for dry-run.
-
#execute ⇒ Hash
Executes the prompt step.
-
#initialize(definition) ⇒ PromptStep
constructor
A new instance of PromptStep.
Constructor Details
#initialize(definition) ⇒ PromptStep
Returns a new instance of PromptStep.
19 20 21 22 23 24 |
# File 'lib/rosett_ai/workflow/steps/prompt_step.rb', line 19 def initialize(definition) @definition = definition @prompt = definition.fetch('prompt') @engine = definition['engine'] validate! end |
Instance Method Details
#describe ⇒ String
Returns step description for dry-run.
27 28 29 30 |
# File 'lib/rosett_ai/workflow/steps/prompt_step.rb', line 27 def describe engine_label = @engine ? " (engine: #{@engine})" : '' "[prompt] #{@definition['name']}#{engine_label} — #{truncate(@prompt, 60)}" end |
#execute ⇒ Hash
Executes the prompt step.
Currently a stub: records the prompt and returns a pass result. Engine integration will dispatch to the configured engine's API.
38 39 40 41 42 43 |
# File 'lib/rosett_ai/workflow/steps/prompt_step.rb', line 38 def execute start = Process.clock_gettime(Process::CLOCK_MONOTONIC) elapsed = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round(1) { status: 'pass', message: "Prompt recorded: #{truncate(@prompt, 80)}", duration_ms: elapsed } end |