Class: Raif::Messages::ToolCallResult
- Inherits:
-
Object
- Object
- Raif::Messages::ToolCallResult
- Defined in:
- lib/raif/messages.rb
Overview
Result of a tool invocation
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider_tool_call_id ⇒ Object
readonly
Returns the value of attribute provider_tool_call_id.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
-
.from_h(hash) ⇒ ToolCallResult
Deserialize from a hash.
Instance Method Summary collapse
-
#initialize(result:, provider_tool_call_id: nil, name: nil) ⇒ ToolCallResult
constructor
A new instance of ToolCallResult.
-
#to_h ⇒ Hash
Hash representation for JSONB storage and LLM APIs.
Constructor Details
#initialize(result:, provider_tool_call_id: nil, name: nil) ⇒ ToolCallResult
Returns a new instance of ToolCallResult.
125 126 127 128 129 |
# File 'lib/raif/messages.rb', line 125 def initialize(result:, provider_tool_call_id: nil, name: nil) @provider_tool_call_id = provider_tool_call_id @name = name @result = result end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
120 121 122 |
# File 'lib/raif/messages.rb', line 120 def name @name end |
#provider_tool_call_id ⇒ Object (readonly)
Returns the value of attribute provider_tool_call_id.
120 121 122 |
# File 'lib/raif/messages.rb', line 120 def provider_tool_call_id @provider_tool_call_id end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
120 121 122 |
# File 'lib/raif/messages.rb', line 120 def result @result end |
Class Method Details
.from_h(hash) ⇒ ToolCallResult
Deserialize from a hash
144 145 146 147 148 149 150 |
# File 'lib/raif/messages.rb', line 144 def self.from_h(hash) new( provider_tool_call_id: hash["provider_tool_call_id"], name: hash["name"], result: hash["result"] ) end |
Instance Method Details
#to_h ⇒ Hash
Returns Hash representation for JSONB storage and LLM APIs.
132 133 134 135 136 137 138 139 |
# File 'lib/raif/messages.rb', line 132 def to_h { "type" => "tool_call_result", "provider_tool_call_id" => provider_tool_call_id, "name" => name, "result" => result }.compact end |