Class: Rubyagents::ActionStep
- Inherits:
-
Data
- Object
- Data
- Rubyagents::ActionStep
- Defined in:
- lib/rubyagents/memory.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#observation ⇒ Object
readonly
Returns the value of attribute observation.
-
#step_number ⇒ Object
readonly
Returns the value of attribute step_number.
-
#thought ⇒ Object
readonly
Returns the value of attribute thought.
-
#token_usage ⇒ Object
readonly
Returns the value of attribute token_usage.
-
#tool_calls ⇒ Object
readonly
Returns the value of attribute tool_calls.
Instance Method Summary collapse
-
#initialize(step_number:, thought:, code: nil, tool_calls: nil, observation: nil, error: nil, duration: 0.0, token_usage: nil) ⇒ ActionStep
constructor
A new instance of ActionStep.
- #to_h ⇒ Object
Constructor Details
#initialize(step_number:, thought:, code: nil, tool_calls: nil, observation: nil, error: nil, duration: 0.0, token_usage: nil) ⇒ ActionStep
Returns a new instance of ActionStep.
5 6 7 8 |
# File 'lib/rubyagents/memory.rb', line 5 def initialize(step_number:, thought:, code: nil, tool_calls: nil, observation: nil, error: nil, duration: 0.0, token_usage: nil) super end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def code @code end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def duration @duration end |
#error ⇒ Object (readonly)
Returns the value of attribute error
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def error @error end |
#observation ⇒ Object (readonly)
Returns the value of attribute observation
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def observation @observation end |
#step_number ⇒ Object (readonly)
Returns the value of attribute step_number
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def step_number @step_number end |
#thought ⇒ Object (readonly)
Returns the value of attribute thought
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def thought @thought end |
#token_usage ⇒ Object (readonly)
Returns the value of attribute token_usage
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def token_usage @token_usage end |
#tool_calls ⇒ Object (readonly)
Returns the value of attribute tool_calls
4 5 6 |
# File 'lib/rubyagents/memory.rb', line 4 def tool_calls @tool_calls end |
Instance Method Details
#to_h ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rubyagents/memory.rb', line 10 def to_h h = { type: "action", step_number: step_number, thought: thought, duration: duration } h[:code] = code if code h[:tool_calls] = tool_calls.map(&:to_h) if tool_calls h[:observation] = observation if observation h[:error] = error if error h[:token_usage] = token_usage.to_h if token_usage h end |