Class: DeepAgentsRb::SubAgent
- Inherits:
-
Object
- Object
- DeepAgentsRb::SubAgent
- Defined in:
- lib/deepagents/deepagentsrb/sub_agent.rb
Overview
SubAgent class to define sub-agents
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, description:, prompt:, tools: nil) ⇒ SubAgent
constructor
A new instance of SubAgent.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, description:, prompt:, tools: nil) ⇒ SubAgent
Returns a new instance of SubAgent.
6 7 8 9 10 11 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 6 def initialize(name:, description:, prompt:, tools: nil) @name = name @description = description @prompt = prompt @tools = tools end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 4 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 4 def name @name end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
4 5 6 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 4 def prompt @prompt end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
4 5 6 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 4 def tools @tools end |
Class Method Details
.from_h(hash) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 23 def self.from_h(hash) new( name: hash[:name], description: hash[:description], prompt: hash[:prompt], tools: hash[:tools] ) end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/deepagents/deepagentsrb/sub_agent.rb', line 13 def to_h hash = { name: @name, description: @description, prompt: @prompt } hash[:tools] = @tools if @tools hash end |