Class: OxAiWorkers::Assistant::Expert

Inherits:
Object
  • Object
show all
Includes:
ModuleBase
Defined in:
lib/oxaiworkers/assistant/expert.rb

Instance Attribute Summary

Attributes included from ModuleBase

#capabilities, #description, #id, #iterator, #role, #title

Attributes included from LoadI18n

#locale

Instance Method Summary collapse

Methods included from ModuleBase

#add_file, #add_image, #add_task, #execute, #init_worker, #replace_context, #run_task, #task=

Methods included from LoadI18n

#store_locale, #with_locale

Constructor Details

#initialize(delayed: false, model: nil, location: nil) ⇒ Expert



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/oxaiworkers/assistant/expert.rb', line 8

def initialize(delayed: false, model: nil, location: nil)
  store_locale

  with_locale do
    @id = 'expert'
    @role = I18n.t('oxaiworkers.assistant.expert.role')
    @description = I18n.t('oxaiworkers.assistant.expert.description')
    @capabilities = I18n.t('oxaiworkers.assistant.expert.capabilities').split(',').map(&:strip)
    @title = I18n.t('oxaiworkers.assistant.expert.title')
  end

  worker = init_worker(delayed:, model:)
  tool = Tool::Wolfram.new(location:)

  @iterator = Iterator.new(
    worker:,
    role: @role,
    tools: [tool],
    call_stack: [
      OxAiWorkers::Iterator.full_function_name(:inner_monologue),
      tool.full_function_name(:ask),
      OxAiWorkers::Iterator.full_function_name(:outer_voice)
    ],
    locale: @locale,
    on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) },
    on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) }
  )
end