Class: Cadenya::Types::ToolResult

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool_call_id: nil, result: nil) ⇒ ToolResult

Returns a new instance of ToolResult.



5910
5911
5912
5913
# File 'lib/cadenya/types.rb', line 5910

def initialize(tool_call_id: nil, result: nil)
  @tool_call_id = tool_call_id
  @result = result
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



5908
5909
5910
# File 'lib/cadenya/types.rb', line 5908

def result
  @result
end

#tool_call_idObject (readonly)

Returns the value of attribute tool_call_id.



5908
5909
5910
# File 'lib/cadenya/types.rb', line 5908

def tool_call_id
  @tool_call_id
end

Class Method Details

.from_json(data) ⇒ Object



5915
5916
5917
5918
5919
5920
# File 'lib/cadenya/types.rb', line 5915

def self.from_json(data)
  new(
    tool_call_id: data["toolCallId"],
    result: data["result"].nil? ? nil : Types::ObjectiveToolCallResult.from_json(data["result"]),
  )
end

Instance Method Details

#to_hObject



5922
5923
5924
5925
5926
5927
# File 'lib/cadenya/types.rb', line 5922

def to_h
  {
    tool_call_id: Util.plain(@tool_call_id),
    result: Util.plain(@result),
  }.reject { |_k, v| v.nil? }
end