Class: Helicone::AgentResult
- Inherits:
-
Object
- Object
- Helicone::AgentResult
- Defined in:
- lib/helicone/agent_result.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#iterations ⇒ Object
readonly
Returns the value of attribute iterations.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(content:, messages:, iterations:, response: nil, max_iterations_reached: false) ⇒ AgentResult
constructor
Initialize an agent result.
-
#max_iterations_reached? ⇒ Boolean
Check if the agent hit the iteration limit.
-
#success? ⇒ Boolean
Check if the agent completed successfully.
-
#tool_calls_made ⇒ Integer
Count of tool calls executed during the run.
-
#tool_results ⇒ Array<Helicone::Message>
Get all tool result messages from the conversation.
Constructor Details
#initialize(content:, messages:, iterations:, response: nil, max_iterations_reached: false) ⇒ AgentResult
Initialize an agent result
14 15 16 17 18 19 20 |
# File 'lib/helicone/agent_result.rb', line 14 def initialize(content:, messages:, iterations:, response: nil, max_iterations_reached: false) @content = content @messages = @iterations = iterations @response = response @max_iterations_reached = max_iterations_reached end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/helicone/agent_result.rb', line 5 def content @content end |
#iterations ⇒ Object (readonly)
Returns the value of attribute iterations.
5 6 7 |
# File 'lib/helicone/agent_result.rb', line 5 def iterations @iterations end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
5 6 7 |
# File 'lib/helicone/agent_result.rb', line 5 def @messages end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/helicone/agent_result.rb', line 5 def response @response end |
Instance Method Details
#max_iterations_reached? ⇒ Boolean
Check if the agent hit the iteration limit
25 26 27 |
# File 'lib/helicone/agent_result.rb', line 25 def max_iterations_reached? @max_iterations_reached end |
#success? ⇒ Boolean
Check if the agent completed successfully
32 33 34 |
# File 'lib/helicone/agent_result.rb', line 32 def success? !@max_iterations_reached && !@content.nil? && !@content.empty? end |
#tool_calls_made ⇒ Integer
Count of tool calls executed during the run
39 40 41 |
# File 'lib/helicone/agent_result.rb', line 39 def tool_calls_made @messages.count { |m| m.respond_to?(:role) && m.role == "tool" } end |
#tool_results ⇒ Array<Helicone::Message>
Get all tool result messages from the conversation
46 47 48 |
# File 'lib/helicone/agent_result.rb', line 46 def tool_results @messages.select { |m| m.respond_to?(:role) && m.role == "tool" } end |