Class: Roast::Workflow::BaseStep

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/workflow/base_step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow, model: "anthropic:claude-opus-4", name: nil, context_path: nil) ⇒ BaseStep

TODO: is this really the model we want to default to, and is this the right place to set it?



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/roast/workflow/base_step.rb', line 13

def initialize(workflow, model: "anthropic:claude-opus-4", name: nil, context_path: nil)
  @workflow = workflow
  @model = model
  @name = normalize_name(name)
  @context_path = context_path || ContextPathResolver.resolve(self.class)
  @print_response = false
  @json = false
  @params = {}
  @coerce_to = nil
  @available_tools = nil
  @resource = workflow.resource if workflow.respond_to?(:resource)
end

Instance Attribute Details

#available_toolsObject

Returns the value of attribute available_tools.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def available_tools
  @available_tools
end

#coerce_toObject

Returns the value of attribute coerce_to.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def coerce_to
  @coerce_to
end

#context_pathObject (readonly)

Returns the value of attribute context_path.



7
8
9
# File 'lib/roast/workflow/base_step.rb', line 7

def context_path
  @context_path
end

#jsonObject

Returns the value of attribute json.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def json
  @json
end

#modelObject

Returns the value of attribute model.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def model
  @model
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/roast/workflow/base_step.rb', line 7

def name
  @name
end

#paramsObject

Returns the value of attribute params.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def params
  @params
end

Returns the value of attribute print_response.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def print_response
  @print_response
end

#resourceObject

Returns the value of attribute resource.



6
7
8
# File 'lib/roast/workflow/base_step.rb', line 6

def resource
  @resource
end

#workflowObject (readonly)

Returns the value of attribute workflow.



7
8
9
# File 'lib/roast/workflow/base_step.rb', line 7

def workflow
  @workflow
end

Instance Method Details

#callObject



26
27
28
29
30
31
32
# File 'lib/roast/workflow/base_step.rb', line 26

def call
  prompt(read_sidecar_prompt)
  result = chat_completion(print_response:, json:, params:, available_tools:)

  # Apply coercion if configured
  apply_coercion(result)
end