Class: Cadenya::Types::AssistantToolCall

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: nil, arguments: nil, function_name: nil) ⇒ AssistantToolCall

Returns a new instance of AssistantToolCall.



985
986
987
988
989
# File 'lib/cadenya/types.rb', line 985

def initialize(tool: nil, arguments: nil, function_name: nil)
  @tool = tool
  @arguments = arguments
  @function_name = function_name
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



983
984
985
# File 'lib/cadenya/types.rb', line 983

def arguments
  @arguments
end

#function_nameObject (readonly)

Returns the value of attribute function_name.



983
984
985
# File 'lib/cadenya/types.rb', line 983

def function_name
  @function_name
end

#toolObject (readonly)

Returns the value of attribute tool.



983
984
985
# File 'lib/cadenya/types.rb', line 983

def tool
  @tool
end

Class Method Details

.from_json(data) ⇒ Object



991
992
993
994
995
996
997
# File 'lib/cadenya/types.rb', line 991

def self.from_json(data)
  new(
    tool: data["tool"].nil? ? nil : Types.decode_CallableTool(data["tool"]),
    arguments: data["arguments"],
    function_name: data["functionName"],
  )
end

Instance Method Details

#to_hObject



999
1000
1001
1002
1003
1004
1005
# File 'lib/cadenya/types.rb', line 999

def to_h
  {
    tool: Util.plain(@tool),
    arguments: Util.plain(@arguments),
    function_name: Util.plain(@function_name),
  }.reject { |_k, v| v.nil? }
end