vapi_server_sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +31 -6
- data/lib/vapi_server_sdk/analytics/client.rb +0 -14
- data/lib/vapi_server_sdk/assistants/client.rb +4 -70
- data/lib/vapi_server_sdk/blocks/client.rb +0 -70
- data/lib/vapi_server_sdk/calls/client.rb +6 -70
- data/lib/vapi_server_sdk/files/client.rb +0 -70
- data/lib/vapi_server_sdk/knowledge_bases/client.rb +0 -70
- data/lib/vapi_server_sdk/logs/client.rb +13 -44
- data/lib/vapi_server_sdk/logs/types/logging_controller_logs_delete_query_request_type.rb +12 -0
- data/lib/vapi_server_sdk/phone_numbers/client.rb +0 -70
- data/lib/vapi_server_sdk/squads/client.rb +8 -70
- data/lib/vapi_server_sdk/tools/client.rb +0 -70
- data/lib/vapi_server_sdk/types/azure_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/bash_tool_with_tool_call.rb +175 -0
- data/lib/vapi_server_sdk/types/bash_tool_with_tool_call_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/client_inbound_message_end_call.rb +47 -0
- data/lib/vapi_server_sdk/types/client_inbound_message_message.rb +13 -0
- data/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
- data/lib/vapi_server_sdk/types/computer_tool_with_tool_call.rb +199 -0
- data/lib/vapi_server_sdk/types/computer_tool_with_tool_call_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb +2 -4
- data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb +34 -47
- data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto_create_plan.rb +97 -0
- data/lib/vapi_server_sdk/types/create_workflow_dto.rb +87 -0
- data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +81 -0
- data/lib/vapi_server_sdk/types/custom_knowledge_base.rb +2 -4
- data/lib/vapi_server_sdk/types/edge.rb +80 -0
- data/lib/vapi_server_sdk/types/edge_condition.rb +94 -0
- data/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +1 -10
- data/lib/vapi_server_sdk/types/gather.rb +87 -0
- data/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/json_schema.rb +13 -2
- data/lib/vapi_server_sdk/types/log.rb +18 -18
- data/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/programmatic_edge_condition.rb +57 -0
- data/lib/vapi_server_sdk/types/say.rb +72 -0
- data/lib/vapi_server_sdk/types/semantic_edge_condition.rb +57 -0
- data/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
- data/lib/vapi_server_sdk/types/subscription.rb +11 -9
- data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call.rb +175 -0
- data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call_messages_item.rb +121 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base.rb +35 -44
- data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_create_plan.rb → trieve_knowledge_base_chunk_plan.rb} +17 -11
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_create.rb +59 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_create_plan.rb +96 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_import.rb +55 -0
- data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan.rb → trieve_knowledge_base_search_plan.rb} +9 -11
- data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan_search_type.rb → trieve_knowledge_base_search_plan_search_type.rb} +1 -1
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +2 -4
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +34 -47
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto_create_plan.rb +97 -0
- data/lib/vapi_server_sdk/types/update_workflow_dto.rb +82 -0
- data/lib/vapi_server_sdk/types/update_workflow_dto_nodes_item.rb +81 -0
- data/lib/vapi_server_sdk/types/vapi_model.rb +27 -1
- data/lib/vapi_server_sdk/types/workflow.rb +125 -0
- data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +81 -0
- metadata +30 -5
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "json_schema"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
class Gather
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :type
|
11
|
+
# @return [Vapi::JsonSchema]
|
12
|
+
attr_reader :schema
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :instruction
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :name
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param type [String]
|
26
|
+
# @param schema [Vapi::JsonSchema]
|
27
|
+
# @param instruction [String]
|
28
|
+
# @param name [String]
|
29
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
# @return [Vapi::Gather]
|
31
|
+
def initialize(type:, instruction:, name:, schema: OMIT, additional_properties: nil)
|
32
|
+
@type = type
|
33
|
+
@schema = schema if schema != OMIT
|
34
|
+
@instruction = instruction
|
35
|
+
@name = name
|
36
|
+
@additional_properties = additional_properties
|
37
|
+
@_field_set = { "type": type, "schema": schema, "instruction": instruction, "name": name }.reject do |_k, v|
|
38
|
+
v == OMIT
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Deserialize a JSON object to an instance of Gather
|
43
|
+
#
|
44
|
+
# @param json_object [String]
|
45
|
+
# @return [Vapi::Gather]
|
46
|
+
def self.from_json(json_object:)
|
47
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
48
|
+
parsed_json = JSON.parse(json_object)
|
49
|
+
type = parsed_json["type"]
|
50
|
+
if parsed_json["schema"].nil?
|
51
|
+
schema = nil
|
52
|
+
else
|
53
|
+
schema = parsed_json["schema"].to_json
|
54
|
+
schema = Vapi::JsonSchema.from_json(json_object: schema)
|
55
|
+
end
|
56
|
+
instruction = parsed_json["instruction"]
|
57
|
+
name = parsed_json["name"]
|
58
|
+
new(
|
59
|
+
type: type,
|
60
|
+
schema: schema,
|
61
|
+
instruction: instruction,
|
62
|
+
name: name,
|
63
|
+
additional_properties: struct
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Serialize an instance of Gather to a JSON object
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
def to_json(*_args)
|
71
|
+
@_field_set&.to_json
|
72
|
+
end
|
73
|
+
|
74
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
75
|
+
# hash and check each fields type against the current object's property
|
76
|
+
# definitions.
|
77
|
+
#
|
78
|
+
# @param obj [Object]
|
79
|
+
# @return [Void]
|
80
|
+
def self.validate_raw(obj:)
|
81
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
82
|
+
obj.schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.schema)
|
83
|
+
obj.instruction.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.")
|
84
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -22,8 +22,6 @@ module Vapi
|
|
22
22
|
# `tool.destinations`. For others like the function tool, these can be custom
|
23
23
|
# configured.
|
24
24
|
attr_reader :messages
|
25
|
-
# @return [String] The type of tool. "ghl" for GHL tool.
|
26
|
-
attr_reader :type
|
27
25
|
# @return [Vapi::ToolCall]
|
28
26
|
attr_reader :tool_call
|
29
27
|
# @return [Vapi::GhlToolMetadata]
|
@@ -63,7 +61,6 @@ module Vapi
|
|
63
61
|
# For some tools, this is auto-filled based on special fields like
|
64
62
|
# `tool.destinations`. For others like the function tool, these can be custom
|
65
63
|
# configured.
|
66
|
-
# @param type [String] The type of tool. "ghl" for GHL tool.
|
67
64
|
# @param tool_call [Vapi::ToolCall]
|
68
65
|
# @param metadata [Vapi::GhlToolMetadata]
|
69
66
|
# @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
|
@@ -83,11 +80,10 @@ module Vapi
|
|
83
80
|
# phoneNumber.serverUrl, then org.serverUrl.
|
84
81
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
85
82
|
# @return [Vapi::GhlToolWithToolCall]
|
86
|
-
def initialize(
|
83
|
+
def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT,
|
87
84
|
additional_properties: nil)
|
88
85
|
@async = async if async != OMIT
|
89
86
|
@messages = messages if messages != OMIT
|
90
|
-
@type = type
|
91
87
|
@tool_call = tool_call
|
92
88
|
@metadata = metadata
|
93
89
|
@function = function if function != OMIT
|
@@ -96,7 +92,6 @@ module Vapi
|
|
96
92
|
@_field_set = {
|
97
93
|
"async": async,
|
98
94
|
"messages": messages,
|
99
|
-
"type": type,
|
100
95
|
"toolCall": tool_call,
|
101
96
|
"metadata": metadata,
|
102
97
|
"function": function,
|
@@ -118,7 +113,6 @@ module Vapi
|
|
118
113
|
item = item.to_json
|
119
114
|
Vapi::GhlToolWithToolCallMessagesItem.from_json(json_object: item)
|
120
115
|
end
|
121
|
-
type = parsed_json["type"]
|
122
116
|
if parsed_json["toolCall"].nil?
|
123
117
|
tool_call = nil
|
124
118
|
else
|
@@ -146,7 +140,6 @@ module Vapi
|
|
146
140
|
new(
|
147
141
|
async: async,
|
148
142
|
messages: messages,
|
149
|
-
type: type,
|
150
143
|
tool_call: tool_call,
|
151
144
|
metadata: metadata,
|
152
145
|
function: function,
|
@@ -171,7 +164,6 @@ module Vapi
|
|
171
164
|
def self.validate_raw(obj:)
|
172
165
|
obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
|
173
166
|
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
174
|
-
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
175
167
|
Vapi::ToolCall.validate_raw(obj: obj.tool_call)
|
176
168
|
Vapi::GhlToolMetadata.validate_raw(obj: obj.metadata)
|
177
169
|
obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
|
@@ -31,6 +31,9 @@ module Vapi
|
|
31
31
|
# @return [Array<String>] This is a list of properties that are required.
|
32
32
|
# This only makes sense if the type is "object".
|
33
33
|
attr_reader :required
|
34
|
+
# @return [Array<String>] This array specifies the allowed values that can be used to restrict the output
|
35
|
+
# of the model.
|
36
|
+
attr_reader :enum
|
34
37
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
35
38
|
attr_reader :additional_properties
|
36
39
|
# @return [Object]
|
@@ -59,21 +62,26 @@ module Vapi
|
|
59
62
|
# @param description [String] This is the description to help the model understand what it needs to output.
|
60
63
|
# @param required [Array<String>] This is a list of properties that are required.
|
61
64
|
# This only makes sense if the type is "object".
|
65
|
+
# @param enum [Array<String>] This array specifies the allowed values that can be used to restrict the output
|
66
|
+
# of the model.
|
62
67
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
63
68
|
# @return [Vapi::JsonSchema]
|
64
|
-
def initialize(type:, items: OMIT, properties: OMIT, description: OMIT, required: OMIT,
|
69
|
+
def initialize(type:, items: OMIT, properties: OMIT, description: OMIT, required: OMIT, enum: OMIT,
|
70
|
+
additional_properties: nil)
|
65
71
|
@type = type
|
66
72
|
@items = items if items != OMIT
|
67
73
|
@properties = properties if properties != OMIT
|
68
74
|
@description = description if description != OMIT
|
69
75
|
@required = required if required != OMIT
|
76
|
+
@enum = enum if enum != OMIT
|
70
77
|
@additional_properties = additional_properties
|
71
78
|
@_field_set = {
|
72
79
|
"type": type,
|
73
80
|
"items": items,
|
74
81
|
"properties": properties,
|
75
82
|
"description": description,
|
76
|
-
"required": required
|
83
|
+
"required": required,
|
84
|
+
"enum": enum
|
77
85
|
}.reject do |_k, v|
|
78
86
|
v == OMIT
|
79
87
|
end
|
@@ -91,12 +99,14 @@ module Vapi
|
|
91
99
|
properties = parsed_json["properties"]
|
92
100
|
description = parsed_json["description"]
|
93
101
|
required = parsed_json["required"]
|
102
|
+
enum = parsed_json["enum"]
|
94
103
|
new(
|
95
104
|
type: type,
|
96
105
|
items: items,
|
97
106
|
properties: properties,
|
98
107
|
description: description,
|
99
108
|
required: required,
|
109
|
+
enum: enum,
|
100
110
|
additional_properties: struct
|
101
111
|
)
|
102
112
|
end
|
@@ -120,6 +130,7 @@ module Vapi
|
|
120
130
|
obj.properties&.is_a?(Hash) != false || raise("Passed value for field obj.properties is not the expected type, validation failed.")
|
121
131
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
122
132
|
obj.required&.is_a?(Array) != false || raise("Passed value for field obj.required is not the expected type, validation failed.")
|
133
|
+
obj.enum&.is_a?(Array) != false || raise("Passed value for field obj.enum is not the expected type, validation failed.")
|
123
134
|
end
|
124
135
|
end
|
125
136
|
end
|
@@ -91,22 +91,22 @@ module Vapi
|
|
91
91
|
# @param call_id [String] This is the ID of the call.
|
92
92
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
93
93
|
# @return [Vapi::Log]
|
94
|
-
def initialize(time:, org_id:, type:, request_duration_seconds
|
95
|
-
request_body
|
94
|
+
def initialize(time:, org_id:, type:, webhook_type: OMIT, resource: OMIT, request_duration_seconds: OMIT,
|
95
|
+
request_started_at: OMIT, request_finished_at: OMIT, request_body: OMIT, request_http_method: OMIT, request_url: OMIT, request_path: OMIT, request_query: OMIT, response_http_code: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil)
|
96
96
|
@time = time
|
97
97
|
@org_id = org_id
|
98
98
|
@type = type
|
99
99
|
@webhook_type = webhook_type if webhook_type != OMIT
|
100
100
|
@resource = resource if resource != OMIT
|
101
|
-
@request_duration_seconds = request_duration_seconds
|
102
|
-
@request_started_at = request_started_at
|
103
|
-
@request_finished_at = request_finished_at
|
104
|
-
@request_body = request_body
|
105
|
-
@request_http_method = request_http_method
|
106
|
-
@request_url = request_url
|
107
|
-
@request_path = request_path
|
101
|
+
@request_duration_seconds = request_duration_seconds if request_duration_seconds != OMIT
|
102
|
+
@request_started_at = request_started_at if request_started_at != OMIT
|
103
|
+
@request_finished_at = request_finished_at if request_finished_at != OMIT
|
104
|
+
@request_body = request_body if request_body != OMIT
|
105
|
+
@request_http_method = request_http_method if request_http_method != OMIT
|
106
|
+
@request_url = request_url if request_url != OMIT
|
107
|
+
@request_path = request_path if request_path != OMIT
|
108
108
|
@request_query = request_query if request_query != OMIT
|
109
|
-
@response_http_code = response_http_code
|
109
|
+
@response_http_code = response_http_code if response_http_code != OMIT
|
110
110
|
@request_ip_address = request_ip_address if request_ip_address != OMIT
|
111
111
|
@request_origin = request_origin if request_origin != OMIT
|
112
112
|
@response_body = response_body if response_body != OMIT
|
@@ -232,15 +232,15 @@ module Vapi
|
|
232
232
|
obj.type.is_a?(Vapi::LogType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
233
233
|
obj.webhook_type&.is_a?(String) != false || raise("Passed value for field obj.webhook_type is not the expected type, validation failed.")
|
234
234
|
obj.resource&.is_a?(Vapi::LogResource) != false || raise("Passed value for field obj.resource is not the expected type, validation failed.")
|
235
|
-
obj.request_duration_seconds
|
236
|
-
obj.request_started_at
|
237
|
-
obj.request_finished_at
|
238
|
-
obj.request_body
|
239
|
-
obj.request_http_method
|
240
|
-
obj.request_url
|
241
|
-
obj.request_path
|
235
|
+
obj.request_duration_seconds&.is_a?(Float) != false || raise("Passed value for field obj.request_duration_seconds is not the expected type, validation failed.")
|
236
|
+
obj.request_started_at&.is_a?(String) != false || raise("Passed value for field obj.request_started_at is not the expected type, validation failed.")
|
237
|
+
obj.request_finished_at&.is_a?(String) != false || raise("Passed value for field obj.request_finished_at is not the expected type, validation failed.")
|
238
|
+
obj.request_body&.is_a?(Hash) != false || raise("Passed value for field obj.request_body is not the expected type, validation failed.")
|
239
|
+
obj.request_http_method&.is_a?(Vapi::LogRequestHttpMethod) != false || raise("Passed value for field obj.request_http_method is not the expected type, validation failed.")
|
240
|
+
obj.request_url&.is_a?(String) != false || raise("Passed value for field obj.request_url is not the expected type, validation failed.")
|
241
|
+
obj.request_path&.is_a?(String) != false || raise("Passed value for field obj.request_path is not the expected type, validation failed.")
|
242
242
|
obj.request_query&.is_a?(String) != false || raise("Passed value for field obj.request_query is not the expected type, validation failed.")
|
243
|
-
obj.response_http_code
|
243
|
+
obj.response_http_code&.is_a?(Float) != false || raise("Passed value for field obj.response_http_code is not the expected type, validation failed.")
|
244
244
|
obj.request_ip_address&.is_a?(String) != false || raise("Passed value for field obj.request_ip_address is not the expected type, validation failed.")
|
245
245
|
obj.request_origin&.is_a?(String) != false || raise("Passed value for field obj.request_origin is not the expected type, validation failed.")
|
246
246
|
obj.response_body&.is_a?(Hash) != false || raise("Passed value for field obj.response_body is not the expected type, validation failed.")
|
@@ -22,8 +22,6 @@ module Vapi
|
|
22
22
|
# `tool.destinations`. For others like the function tool, these can be custom
|
23
23
|
# configured.
|
24
24
|
attr_reader :messages
|
25
|
-
# @return [String] The type of tool. "make" for Make tool.
|
26
|
-
attr_reader :type
|
27
25
|
# @return [Vapi::ToolCall]
|
28
26
|
attr_reader :tool_call
|
29
27
|
# @return [Vapi::MakeToolMetadata]
|
@@ -63,7 +61,6 @@ module Vapi
|
|
63
61
|
# For some tools, this is auto-filled based on special fields like
|
64
62
|
# `tool.destinations`. For others like the function tool, these can be custom
|
65
63
|
# configured.
|
66
|
-
# @param type [String] The type of tool. "make" for Make tool.
|
67
64
|
# @param tool_call [Vapi::ToolCall]
|
68
65
|
# @param metadata [Vapi::MakeToolMetadata]
|
69
66
|
# @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
|
@@ -83,11 +80,10 @@ module Vapi
|
|
83
80
|
# phoneNumber.serverUrl, then org.serverUrl.
|
84
81
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
85
82
|
# @return [Vapi::MakeToolWithToolCall]
|
86
|
-
def initialize(
|
83
|
+
def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT,
|
87
84
|
additional_properties: nil)
|
88
85
|
@async = async if async != OMIT
|
89
86
|
@messages = messages if messages != OMIT
|
90
|
-
@type = type
|
91
87
|
@tool_call = tool_call
|
92
88
|
@metadata = metadata
|
93
89
|
@function = function if function != OMIT
|
@@ -96,7 +92,6 @@ module Vapi
|
|
96
92
|
@_field_set = {
|
97
93
|
"async": async,
|
98
94
|
"messages": messages,
|
99
|
-
"type": type,
|
100
95
|
"toolCall": tool_call,
|
101
96
|
"metadata": metadata,
|
102
97
|
"function": function,
|
@@ -118,7 +113,6 @@ module Vapi
|
|
118
113
|
item = item.to_json
|
119
114
|
Vapi::MakeToolWithToolCallMessagesItem.from_json(json_object: item)
|
120
115
|
end
|
121
|
-
type = parsed_json["type"]
|
122
116
|
if parsed_json["toolCall"].nil?
|
123
117
|
tool_call = nil
|
124
118
|
else
|
@@ -146,7 +140,6 @@ module Vapi
|
|
146
140
|
new(
|
147
141
|
async: async,
|
148
142
|
messages: messages,
|
149
|
-
type: type,
|
150
143
|
tool_call: tool_call,
|
151
144
|
metadata: metadata,
|
152
145
|
function: function,
|
@@ -171,7 +164,6 @@ module Vapi
|
|
171
164
|
def self.validate_raw(obj:)
|
172
165
|
obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
|
173
166
|
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
174
|
-
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
175
167
|
Vapi::ToolCall.validate_raw(obj: obj.tool_call)
|
176
168
|
Vapi::MakeToolMetadata.validate_raw(obj: obj.metadata)
|
177
169
|
obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class ProgrammaticEdgeCondition
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :boolean_expression
|
10
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
attr_reader :additional_properties
|
12
|
+
# @return [Object]
|
13
|
+
attr_reader :_field_set
|
14
|
+
protected :_field_set
|
15
|
+
|
16
|
+
OMIT = Object.new
|
17
|
+
|
18
|
+
# @param boolean_expression [String]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [Vapi::ProgrammaticEdgeCondition]
|
21
|
+
def initialize(boolean_expression: OMIT, additional_properties: nil)
|
22
|
+
@boolean_expression = boolean_expression if boolean_expression != OMIT
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
@_field_set = { "booleanExpression": boolean_expression }.reject do |_k, v|
|
25
|
+
v == OMIT
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of ProgrammaticEdgeCondition
|
30
|
+
#
|
31
|
+
# @param json_object [String]
|
32
|
+
# @return [Vapi::ProgrammaticEdgeCondition]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
boolean_expression = parsed_json["booleanExpression"]
|
37
|
+
new(boolean_expression: boolean_expression, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of ProgrammaticEdgeCondition to a JSON object
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
def to_json(*_args)
|
44
|
+
@_field_set&.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
48
|
+
# hash and check each fields type against the current object's property
|
49
|
+
# definitions.
|
50
|
+
#
|
51
|
+
# @param obj [Object]
|
52
|
+
# @return [Void]
|
53
|
+
def self.validate_raw(obj:)
|
54
|
+
obj.boolean_expression&.is_a?(String) != false || raise("Passed value for field obj.boolean_expression is not the expected type, validation failed.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class Say
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :type
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :instruction
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :name
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param type [String]
|
23
|
+
# @param instruction [String]
|
24
|
+
# @param name [String]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vapi::Say]
|
27
|
+
def initialize(type:, instruction:, name:, additional_properties: nil)
|
28
|
+
@type = type
|
29
|
+
@instruction = instruction
|
30
|
+
@name = name
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "type": type, "instruction": instruction, "name": name }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of Say
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [Vapi::Say]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
type = parsed_json["type"]
|
43
|
+
instruction = parsed_json["instruction"]
|
44
|
+
name = parsed_json["name"]
|
45
|
+
new(
|
46
|
+
type: type,
|
47
|
+
instruction: instruction,
|
48
|
+
name: name,
|
49
|
+
additional_properties: struct
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Serialize an instance of Say to a JSON object
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
def to_json(*_args)
|
57
|
+
@_field_set&.to_json
|
58
|
+
end
|
59
|
+
|
60
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
61
|
+
# hash and check each fields type against the current object's property
|
62
|
+
# definitions.
|
63
|
+
#
|
64
|
+
# @param obj [Object]
|
65
|
+
# @return [Void]
|
66
|
+
def self.validate_raw(obj:)
|
67
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
68
|
+
obj.instruction.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.")
|
69
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class SemanticEdgeCondition
|
8
|
+
# @return [Array<String>]
|
9
|
+
attr_reader :matches
|
10
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
attr_reader :additional_properties
|
12
|
+
# @return [Object]
|
13
|
+
attr_reader :_field_set
|
14
|
+
protected :_field_set
|
15
|
+
|
16
|
+
OMIT = Object.new
|
17
|
+
|
18
|
+
# @param matches [Array<String>]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [Vapi::SemanticEdgeCondition]
|
21
|
+
def initialize(matches: OMIT, additional_properties: nil)
|
22
|
+
@matches = matches if matches != OMIT
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
@_field_set = { "matches": matches }.reject do |_k, v|
|
25
|
+
v == OMIT
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of SemanticEdgeCondition
|
30
|
+
#
|
31
|
+
# @param json_object [String]
|
32
|
+
# @return [Vapi::SemanticEdgeCondition]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
matches = parsed_json["matches"]
|
37
|
+
new(matches: matches, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of SemanticEdgeCondition to a JSON object
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
def to_json(*_args)
|
44
|
+
@_field_set&.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
48
|
+
# hash and check each fields type against the current object's property
|
49
|
+
# definitions.
|
50
|
+
#
|
51
|
+
# @param obj [Object]
|
52
|
+
# @return [Void]
|
53
|
+
def self.validate_raw(obj:)
|
54
|
+
obj.matches&.is_a?(Array) != false || raise("Passed value for field obj.matches is not the expected type, validation failed.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|