Class: Rubyagents::CodeAgent
- Defined in:
- lib/rubyagents/code_agent.rb
Constant Summary collapse
- CODE_BLOCK_RE =
/```ruby\s*\n(.*?)```/m
Instance Attribute Summary
Attributes inherited from Agent
#callbacks, #description, #max_steps, #memory, #model, #name, #planning_interval, #step_callbacks, #tools
Instance Method Summary collapse
-
#initialize(model:, tools: [], agents: [], name: nil, description: nil, max_steps: 10, timeout: 30, planning_interval: nil, step_callbacks: [], callbacks: [], final_answer_checks: [], prompt_templates: nil, instructions: nil, output_type: nil) ⇒ CodeAgent
constructor
A new instance of CodeAgent.
Methods inherited from Agent
#done?, #final_answer_value, #interrupt, #reset!, #run, #step
Constructor Details
#initialize(model:, tools: [], agents: [], name: nil, description: nil, max_steps: 10, timeout: 30, planning_interval: nil, step_callbacks: [], callbacks: [], final_answer_checks: [], prompt_templates: nil, instructions: nil, output_type: nil) ⇒ CodeAgent
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubyagents/code_agent.rb', line 7 def initialize(model:, tools: [], agents: [], name: nil, description: nil, max_steps: 10, timeout: 30, planning_interval: nil, step_callbacks: [], callbacks: [], final_answer_checks: [], prompt_templates: nil, instructions: nil, output_type: nil) require_relative "tools/list_gems" tools = [ListGems] + tools unless tools.any? { |t| t == ListGems || (t.is_a?(Tool) && t.is_a?(ListGems)) } super(model: model, tools: tools, agents: agents, name: name, description: description, max_steps: max_steps, planning_interval: planning_interval, step_callbacks: step_callbacks, callbacks: callbacks, final_answer_checks: final_answer_checks, prompt_templates: prompt_templates, instructions: instructions, output_type: output_type) @timeout = timeout end |