Class: OxAiWorkers::Assistant::Orchestrator
- Inherits:
-
Object
- Object
- OxAiWorkers::Assistant::Orchestrator
- Includes:
- ModuleBase
- Defined in:
- lib/oxaiworkers/assistant/orchestrator.rb
Instance Attribute Summary collapse
-
#workflow ⇒ Object
Returns the value of attribute workflow.
Attributes included from ModuleBase
#capabilities, #description, #id, #iterator, #role, #title
Attributes included from LoadI18n
Instance Method Summary collapse
- #add_assistant(assistant) ⇒ Object
-
#initialize(delayed: false, model: nil, role: nil, workflow: nil) ⇒ Orchestrator
constructor
A new instance of Orchestrator.
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(delayed: false, model: nil, role: nil, workflow: nil) ⇒ Orchestrator
Returns a new instance of Orchestrator.
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 36 37 |
# File 'lib/oxaiworkers/assistant/orchestrator.rb', line 10 def initialize(delayed: false, model: nil, role: nil, workflow: nil) store_locale @pipeline = Tool::Pipeline.new( on_message: ->(text:) { @iterator.add_queue text } ) with_locale do @id = 'orchestrator' @role = role || I18n.t('oxaiworkers.assistant.orchestrator.role') @description = I18n.t('oxaiworkers.assistant.orchestrator.description') @capabilities = I18n.t('oxaiworkers.assistant.orchestrator.capabilities').split(',').map(&:strip) @title = I18n.t('oxaiworkers.assistant.orchestrator.title') @workflow = I18n.t('oxaiworkers.assistant.orchestrator.workflow_task', workflow_description: workflow) end @iterator = Iterator.new( worker: init_worker(delayed:, model:), role: @role, tools: [@pipeline], locale: @locale, on_inner_monologue: ->(text:) { @pipeline.recive_monologue(from_id: @id, message: text) }, on_outer_voice: ->(text:) { @pipeline.recive_voice(from_id: @id, message: text) } ) @iterator.add_task @workflow end |
Instance Attribute Details
#workflow ⇒ Object
Returns the value of attribute workflow.
8 9 10 |
# File 'lib/oxaiworkers/assistant/orchestrator.rb', line 8 def workflow @workflow end |
Instance Method Details
#add_assistant(assistant) ⇒ Object
39 40 41 |
# File 'lib/oxaiworkers/assistant/orchestrator.rb', line 39 def add_assistant(assistant) @pipeline.add_assistant(assistant) end |