Class: Cadenya::Types::ToolCalled

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, tool: nil, config: nil, arguments: nil, arguments_exposed_in_widgets: nil) ⇒ ToolCalled

Returns a new instance of ToolCalled.



5676
5677
5678
5679
5680
5681
5682
# File 'lib/cadenya/types.rb', line 5676

def initialize(tool_call_id: nil, tool: nil, config: nil, arguments: nil, arguments_exposed_in_widgets: nil)
  @tool_call_id = tool_call_id
  @tool = tool
  @config = config
  @arguments = arguments
  @arguments_exposed_in_widgets = arguments_exposed_in_widgets
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



5674
5675
5676
# File 'lib/cadenya/types.rb', line 5674

def arguments
  @arguments
end

#arguments_exposed_in_widgetsObject (readonly)

Returns the value of attribute arguments_exposed_in_widgets.



5674
5675
5676
# File 'lib/cadenya/types.rb', line 5674

def arguments_exposed_in_widgets
  @arguments_exposed_in_widgets
end

#configObject (readonly)

Returns the value of attribute config.



5674
5675
5676
# File 'lib/cadenya/types.rb', line 5674

def config
  @config
end

#toolObject (readonly)

Returns the value of attribute tool.



5674
5675
5676
# File 'lib/cadenya/types.rb', line 5674

def tool
  @tool
end

#tool_call_idObject (readonly)

Returns the value of attribute tool_call_id.



5674
5675
5676
# File 'lib/cadenya/types.rb', line 5674

def tool_call_id
  @tool_call_id
end

Class Method Details

.from_json(data) ⇒ Object



5684
5685
5686
5687
5688
5689
5690
5691
5692
# File 'lib/cadenya/types.rb', line 5684

def self.from_json(data)
  new(
    tool_call_id: data["toolCallId"],
    tool: data["tool"].nil? ? nil : Types.decode_CallableTool(data["tool"]),
    config: data["config"].nil? ? nil : Types.decode_ToolSpec_Config(data["config"]),
    arguments: data["arguments"],
    arguments_exposed_in_widgets: data["argumentsExposedInWidgets"],
  )
end

Instance Method Details

#to_hObject



5694
5695
5696
5697
5698
5699
5700
5701
5702
# File 'lib/cadenya/types.rb', line 5694

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