Class: Roast::Workflow::BaseStep

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

Direct Known Subclasses

PromptStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow, model: "anthropic:claude-3-7-sonnet", name: nil, context_path: nil, auto_loop: true) ⇒ BaseStep

Returns a new instance of BaseStep.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/roast/workflow/base_step.rb', line 18

def initialize(workflow, model: "anthropic:claude-3-7-sonnet", name: nil, context_path: nil, auto_loop: true)
  @workflow = workflow
  @model = model
  @name = name || self.class.name.underscore.split("/").last
  @context_path = context_path || determine_context_path
  @print_response = false
  @auto_loop = auto_loop
  @json = false
  @params = {}
  @resource = workflow.resource if workflow.respond_to?(:resource)
end

Instance Attribute Details

#auto_loopObject

Returns the value of attribute auto_loop.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def auto_loop
  @auto_loop
end

#context_pathObject (readonly)

Returns the value of attribute context_path.



12
13
14
# File 'lib/roast/workflow/base_step.rb', line 12

def context_path
  @context_path
end

#jsonObject

Returns the value of attribute json.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def json
  @json
end

#modelObject

Returns the value of attribute model.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def model
  @model
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/roast/workflow/base_step.rb', line 12

def name
  @name
end

#paramsObject

Returns the value of attribute params.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def params
  @params
end

Returns the value of attribute print_response.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def print_response
  @print_response
end

#resourceObject

Returns the value of attribute resource.



11
12
13
# File 'lib/roast/workflow/base_step.rb', line 11

def resource
  @resource
end

#workflowObject (readonly)

Returns the value of attribute workflow.



12
13
14
# File 'lib/roast/workflow/base_step.rb', line 12

def workflow
  @workflow
end

Instance Method Details

#callObject



30
31
32
33
# File 'lib/roast/workflow/base_step.rb', line 30

def call
  prompt(read_sidecar_prompt)
  chat_completion(print_response:, auto_loop:, json:, params:)
end