Class: RosettAi::Workflow::Steps::PromptStep

Inherits:
Object
  • Object
show all
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.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ PromptStep

Returns a new instance of PromptStep.

Parameters:

  • definition (Hash)

    step definition from workflow YAML



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

#describeString

Returns step description for dry-run.

Returns:

  • (String)

    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

#executeHash

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.

Returns:

  • (Hash)

    execution result with :status and :message



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