Class: Vapi::CreateComputerToolDto
- Inherits:
-
Object
- Object
- Vapi::CreateComputerToolDto
- Defined in:
- lib/vapi_server_sdk/types/create_computer_tool_dto.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#display_height_px ⇒ Float
readonly
The display height in pixels.
-
#display_number ⇒ Float
readonly
Optional display number.
-
#display_width_px ⇒ Float
readonly
The display width in pixels.
-
#function ⇒ Vapi::OpenAiFunction
readonly
This is the function definition of the tool.
-
#messages ⇒ Array<Vapi::CreateComputerToolDtoMessagesItem>
readonly
These are the messages that will be spoken to the user as the tool is running.
-
#name ⇒ String
readonly
The name of the tool, fixed to ‘computer’.
-
#server ⇒ Vapi::Server
readonly
This is the server where a ‘tool-calls` webhook will be sent.
-
#sub_type ⇒ String
readonly
The sub type of tool.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CreateComputerToolDto
Deserialize a JSON object to an instance of CreateComputerToolDto.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(sub_type:, name:, display_width_px:, display_height_px:, messages: OMIT, server: OMIT, display_number: OMIT, function: OMIT, additional_properties: nil) ⇒ Vapi::CreateComputerToolDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateComputerToolDto to a JSON object.
Constructor Details
#initialize(sub_type:, name:, display_width_px:, display_height_px:, messages: OMIT, server: OMIT, display_number: OMIT, function: OMIT, additional_properties: nil) ⇒ Vapi::CreateComputerToolDto
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 85 def initialize(sub_type:, name:, display_width_px:, display_height_px:, messages: OMIT, server: OMIT, display_number: OMIT, function: OMIT, additional_properties: nil) @messages = if != OMIT @sub_type = sub_type @server = server if server != OMIT @name = name @display_width_px = display_width_px @display_height_px = display_height_px @display_number = display_number if display_number != OMIT @function = function if function != OMIT @additional_properties = additional_properties @_field_set = { "messages": , "subType": sub_type, "server": server, "name": name, "displayWidthPx": display_width_px, "displayHeightPx": display_height_px, "displayNumber": display_number, "function": function }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
48 49 50 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 48 def additional_properties @additional_properties end |
#display_height_px ⇒ Float (readonly)
34 35 36 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 34 def display_height_px @display_height_px end |
#display_number ⇒ Float (readonly)
36 37 38 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 36 def display_number @display_number end |
#display_width_px ⇒ Float (readonly)
32 33 34 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 32 def display_width_px @display_width_px end |
#function ⇒ Vapi::OpenAiFunction (readonly)
46 47 48 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 46 def function @function end |
#messages ⇒ Array<Vapi::CreateComputerToolDtoMessagesItem> (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 15 def @messages end |
#name ⇒ String (readonly)
30 31 32 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 30 def name @name end |
#server ⇒ Vapi::Server (readonly)
28 29 30 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 28 def server @server end |
#sub_type ⇒ String (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 17 def sub_type @sub_type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateComputerToolDto
Deserialize a JSON object to an instance of CreateComputerToolDto
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 114 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["messages"]&.map do |item| item = item.to_json Vapi::CreateComputerToolDtoMessagesItem.from_json(json_object: item) end sub_type = parsed_json["subType"] if parsed_json["server"].nil? server = nil else server = parsed_json["server"].to_json server = Vapi::Server.from_json(json_object: server) end name = parsed_json["name"] display_width_px = parsed_json["displayWidthPx"] display_height_px = parsed_json["displayHeightPx"] display_number = parsed_json["displayNumber"] if parsed_json["function"].nil? function = nil else function = parsed_json["function"].to_json function = Vapi::OpenAiFunction.from_json(json_object: function) end new( messages: , sub_type: sub_type, server: server, name: name, display_width_px: display_width_px, display_height_px: display_height_px, display_number: display_number, function: function, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 164 def self.validate_raw(obj:) obj.&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.display_width_px.is_a?(Float) != false || raise("Passed value for field obj.display_width_px is not the expected type, validation failed.") obj.display_height_px.is_a?(Float) != false || raise("Passed value for field obj.display_height_px is not the expected type, validation failed.") obj.display_number&.is_a?(Float) != false || raise("Passed value for field obj.display_number is not the expected type, validation failed.") obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreateComputerToolDto to a JSON object
154 155 156 |
# File 'lib/vapi_server_sdk/types/create_computer_tool_dto.rb', line 154 def to_json(*_args) @_field_set&.to_json end |