Class: Soka::Engines::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/soka/engines/base.rb

Overview

Base class for reasoning engines

Direct Known Subclasses

React

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent, tools, **options) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
# File 'lib/soka/engines/base.rb', line 9

def initialize(agent, tools, **options)
  @agent = agent
  @tools = tools
  @llm = options[:llm]
  @max_iterations = options[:max_iterations] || 10
  @custom_instructions = options[:custom_instructions]
  @think_in = options[:think_in]
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def agent
  @agent
end

#custom_instructionsObject (readonly)

Returns the value of attribute custom_instructions.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def custom_instructions
  @custom_instructions
end

#llmObject (readonly)

Returns the value of attribute llm.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def llm
  @llm
end

#max_iterationsObject (readonly)

Returns the value of attribute max_iterations.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def max_iterations
  @max_iterations
end

#think_inObject (readonly)

Returns the value of attribute think_in.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def think_in
  @think_in
end

#toolsObject (readonly)

Returns the value of attribute tools.



7
8
9
# File 'lib/soka/engines/base.rb', line 7

def tools
  @tools
end

Instance Method Details

#reason(task) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/soka/engines/base.rb', line 18

def reason(task)
  raise NotImplementedError, "#{self.class} must implement #reason method"
end