Class: Vapi::UpdateFunctionToolDto
- Inherits:
-
Object
- Object
- Vapi::UpdateFunctionToolDto
- Defined in:
- lib/vapi_server_sdk/types/update_function_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.
-
#async ⇒ Boolean
readonly
This determines if the tool is async.
-
#function ⇒ Vapi::OpenAiFunction
readonly
This is the function definition of the tool.
-
#messages ⇒ Array<Vapi::UpdateFunctionToolDtoMessagesItem>
readonly
These are the messages that will be spoken to the user as the tool is running.
-
#server ⇒ Vapi::Server
readonly
This is the server where a ‘tool-calls` webhook will be sent.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::UpdateFunctionToolDto
Deserialize a JSON object to an instance of UpdateFunctionToolDto.
-
.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(messages: OMIT, async: OMIT, server: OMIT, function: OMIT, additional_properties: nil) ⇒ Vapi::UpdateFunctionToolDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of UpdateFunctionToolDto to a JSON object.
Constructor Details
#initialize(messages: OMIT, async: OMIT, server: OMIT, function: OMIT, additional_properties: nil) ⇒ Vapi::UpdateFunctionToolDto
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 83 def initialize(messages: OMIT, async: OMIT, server: OMIT, function: OMIT, additional_properties: nil) @messages = if != OMIT @async = async if async != OMIT @server = server if server != OMIT @function = function if function != OMIT @additional_properties = additional_properties @_field_set = { "messages": , "async": async, "server": server, "function": function }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
45 46 47 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 45 def additional_properties @additional_properties end |
#async ⇒ Boolean (readonly)
22 23 24 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 22 def async @async end |
#function ⇒ Vapi::OpenAiFunction (readonly)
43 44 45 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 43 def function @function end |
#messages ⇒ Array<Vapi::UpdateFunctionToolDtoMessagesItem> (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 15 def @messages end |
#server ⇒ Vapi::Server (readonly)
33 34 35 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 33 def server @server end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::UpdateFunctionToolDto
Deserialize a JSON object to an instance of UpdateFunctionToolDto
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 98 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::UpdateFunctionToolDtoMessagesItem.from_json(json_object: item) end async = parsed_json["async"] if parsed_json["server"].nil? server = nil else server = parsed_json["server"].to_json server = Vapi::Server.from_json(json_object: server) end 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: , async: async, server: server, 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.
140 141 142 143 144 145 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 140 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.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of UpdateFunctionToolDto to a JSON object
130 131 132 |
# File 'lib/vapi_server_sdk/types/update_function_tool_dto.rb', line 130 def to_json(*_args) @_field_set&.to_json end |