Class: OpenAISwarm::Agent
- Inherits:
-
Object
- Object
- OpenAISwarm::Agent
- Defined in:
- lib/ruby-openai-swarm/agent.rb
Instance Attribute Summary collapse
-
#current_tool_name ⇒ Object
Returns the value of attribute current_tool_name.
-
#functions ⇒ Object
Returns the value of attribute functions.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#model ⇒ Object
Returns the value of attribute model.
-
#name ⇒ Object
Returns the value of attribute name.
-
#noisy_tool_calls ⇒ Object
Returns the value of attribute noisy_tool_calls.
-
#parallel_tool_calls ⇒ Object
Returns the value of attribute parallel_tool_calls.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#tool_choice ⇒ Object
Returns the value of attribute tool_choice.
Instance Method Summary collapse
-
#initialize(name: "Agent", model: "gpt-4", instructions: "You are a helpful agent.", functions: [], tool_choice: nil, temperature: nil, parallel_tool_calls: true, resource: nil, noisy_tool_calls: [], strategy: {}, current_tool_name: nil, memory: nil) ⇒ Agent
constructor
These attributes can be read and written externally.
Constructor Details
#initialize(name: "Agent", model: "gpt-4", instructions: "You are a helpful agent.", functions: [], tool_choice: nil, temperature: nil, parallel_tool_calls: true, resource: nil, noisy_tool_calls: [], strategy: {}, current_tool_name: nil, memory: nil) ⇒ Agent
These attributes can be read and written externally. They include:
-
name: The name of the agent.
-
model: The model used, e.g., “gpt-4”.
-
resource: Additional custom parameters or data that the agent might need.
-
noisy_tool_calls: is an array that contains the names of tool calls that should be excluded because they are considered “noise”.
These tool calls generate irrelevant or unnecessary messages that the agent should not send to OpenAI. When filtering messages, any message that includes these tool calls will be removed from the list, preventing them from being sent to OpenAI.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruby-openai-swarm/agent.rb', line 20 def initialize( name: "Agent", model: "gpt-4", instructions: "You are a helpful agent.", functions: [], tool_choice: nil, temperature: nil, parallel_tool_calls: true, resource: nil, noisy_tool_calls: [], strategy: {}, current_tool_name: nil, memory: nil ) @name = name @model = model @instructions = instructions @functions = functions @tool_choice = tool_choice @temperature = temperature @parallel_tool_calls = parallel_tool_calls @resource = resource @noisy_tool_calls = noisy_tool_calls @strategy = Agents::StrategyOptions.new(strategy) @current_tool_name = current_tool_name.nil? ? nil : current_tool_name.to_s @memory = memory end |
Instance Attribute Details
#current_tool_name ⇒ Object
Returns the value of attribute current_tool_name.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def current_tool_name @current_tool_name end |
#functions ⇒ Object
Returns the value of attribute functions.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def functions @functions end |
#instructions ⇒ Object
Returns the value of attribute instructions.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def instructions @instructions end |
#memory ⇒ Object
Returns the value of attribute memory.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def memory @memory end |
#model ⇒ Object
Returns the value of attribute model.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def model @model end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def name @name end |
#noisy_tool_calls ⇒ Object
Returns the value of attribute noisy_tool_calls.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def noisy_tool_calls @noisy_tool_calls end |
#parallel_tool_calls ⇒ Object
Returns the value of attribute parallel_tool_calls.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def parallel_tool_calls @parallel_tool_calls end |
#resource ⇒ Object
Returns the value of attribute resource.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def resource @resource end |
#strategy ⇒ Object
Returns the value of attribute strategy.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def strategy @strategy end |
#temperature ⇒ Object
Returns the value of attribute temperature.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def temperature @temperature end |
#tool_choice ⇒ Object
Returns the value of attribute tool_choice.
3 4 5 |
# File 'lib/ruby-openai-swarm/agent.rb', line 3 def tool_choice @tool_choice end |