Class: OxAiWorkers::Assistant::Coder
- Inherits:
-
Object
- Object
- OxAiWorkers::Assistant::Coder
- Includes:
- ModuleBase
- Defined in:
- lib/oxaiworkers/assistant/coder.rb
Instance Attribute Summary
Attributes included from ModuleBase
#capabilities, #description, #id, #iterator, #role, #title
Attributes included from LoadI18n
Instance Method Summary collapse
-
#initialize(current_dir: nil, delayed: false, model: nil, language: 'ruby') ⇒ Coder
constructor
A new instance of Coder.
- #language=(language) ⇒ Object
Methods included from ModuleBase
#add_file, #add_image, #add_task, #execute, #init_worker, #replace_context, #run_task, #task=
Methods included from LoadI18n
Constructor Details
#initialize(current_dir: nil, delayed: false, model: nil, language: 'ruby') ⇒ Coder
Returns a new instance of Coder.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/oxaiworkers/assistant/coder.rb', line 8 def initialize(current_dir: nil, delayed: false, model: nil, language: 'ruby') store_locale with_locale do @id = 'coder' @role = format(I18n.t('oxaiworkers.assistant.coder.role'), language) @description = I18n.t('oxaiworkers.assistant.coder.description') @capabilities = I18n.t('oxaiworkers.assistant.coder.capabilities').split(',').map(&:strip) @title = I18n.t('oxaiworkers.assistant.coder.title') end @iterator = Iterator.new( worker: init_worker(delayed:, model:), role: @role, tools: [Tool::Eval.new(current_dir:), Tool::FileSystem.new(current_dir:)], locale: @locale, on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) }, on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) } ) end |
Instance Method Details
#language=(language) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/oxaiworkers/assistant/coder.rb', line 29 def language=(language) with_locale do @role = format(I18n.t('oxaiworkers.assistant.coder.role'), language) @iterator.role = @role end end |