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
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
4
|
-
require_relative "
|
3
|
+
require_relative "trieve_knowledge_base_search_plan"
|
4
|
+
require_relative "update_trieve_knowledge_base_dto_create_plan"
|
5
5
|
require "ostruct"
|
6
6
|
require "json"
|
7
7
|
|
@@ -9,17 +9,15 @@ module Vapi
|
|
9
9
|
class UpdateTrieveKnowledgeBaseDto
|
10
10
|
# @return [String] This is the name of the knowledge base.
|
11
11
|
attr_reader :name
|
12
|
-
# @return [Vapi::
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
# - Create a dataset, and use the datasetId here.
|
22
|
-
attr_reader :vector_store_provider_id
|
12
|
+
# @return [Vapi::TrieveKnowledgeBaseSearchPlan] This is the searching plan used when searching for relevant chunks from the
|
13
|
+
# vector store.
|
14
|
+
# You should configure this if you're running into these issues:
|
15
|
+
# - Too much unnecessary context is being fed as knowledge base context.
|
16
|
+
# - Not enough relevant context is being fed as knowledge base context.
|
17
|
+
attr_reader :search_plan
|
18
|
+
# @return [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan] This is the plan if you want us to create/import a new vector store using
|
19
|
+
# Trieve.
|
20
|
+
attr_reader :create_plan
|
23
21
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
24
22
|
attr_reader :additional_properties
|
25
23
|
# @return [Object]
|
@@ -29,29 +27,21 @@ module Vapi
|
|
29
27
|
OMIT = Object.new
|
30
28
|
|
31
29
|
# @param name [String] This is the name of the knowledge base.
|
32
|
-
# @param
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
# - Create a dataset, and use the datasetId here.
|
30
|
+
# @param search_plan [Vapi::TrieveKnowledgeBaseSearchPlan] This is the searching plan used when searching for relevant chunks from the
|
31
|
+
# vector store.
|
32
|
+
# You should configure this if you're running into these issues:
|
33
|
+
# - Too much unnecessary context is being fed as knowledge base context.
|
34
|
+
# - Not enough relevant context is being fed as knowledge base context.
|
35
|
+
# @param create_plan [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan] This is the plan if you want us to create/import a new vector store using
|
36
|
+
# Trieve.
|
40
37
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
41
38
|
# @return [Vapi::UpdateTrieveKnowledgeBaseDto]
|
42
|
-
def initialize(name: OMIT,
|
43
|
-
vector_store_provider_id: OMIT, additional_properties: nil)
|
39
|
+
def initialize(name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil)
|
44
40
|
@name = name if name != OMIT
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@vector_store_provider_id = vector_store_provider_id if vector_store_provider_id != OMIT
|
41
|
+
@search_plan = search_plan if search_plan != OMIT
|
42
|
+
@create_plan = create_plan if create_plan != OMIT
|
48
43
|
@additional_properties = additional_properties
|
49
|
-
@_field_set = {
|
50
|
-
"name": name,
|
51
|
-
"vectorStoreSearchPlan": vector_store_search_plan,
|
52
|
-
"vectorStoreCreatePlan": vector_store_create_plan,
|
53
|
-
"vectorStoreProviderId": vector_store_provider_id
|
54
|
-
}.reject do |_k, v|
|
44
|
+
@_field_set = { "name": name, "searchPlan": search_plan, "createPlan": create_plan }.reject do |_k, v|
|
55
45
|
v == OMIT
|
56
46
|
end
|
57
47
|
end
|
@@ -64,24 +54,22 @@ module Vapi
|
|
64
54
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
65
55
|
parsed_json = JSON.parse(json_object)
|
66
56
|
name = parsed_json["name"]
|
67
|
-
if parsed_json["
|
68
|
-
|
57
|
+
if parsed_json["searchPlan"].nil?
|
58
|
+
search_plan = nil
|
69
59
|
else
|
70
|
-
|
71
|
-
|
60
|
+
search_plan = parsed_json["searchPlan"].to_json
|
61
|
+
search_plan = Vapi::TrieveKnowledgeBaseSearchPlan.from_json(json_object: search_plan)
|
72
62
|
end
|
73
|
-
if parsed_json["
|
74
|
-
|
63
|
+
if parsed_json["createPlan"].nil?
|
64
|
+
create_plan = nil
|
75
65
|
else
|
76
|
-
|
77
|
-
|
66
|
+
create_plan = parsed_json["createPlan"].to_json
|
67
|
+
create_plan = Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan.from_json(json_object: create_plan)
|
78
68
|
end
|
79
|
-
vector_store_provider_id = parsed_json["vectorStoreProviderId"]
|
80
69
|
new(
|
81
70
|
name: name,
|
82
|
-
|
83
|
-
|
84
|
-
vector_store_provider_id: vector_store_provider_id,
|
71
|
+
search_plan: search_plan,
|
72
|
+
create_plan: create_plan,
|
85
73
|
additional_properties: struct
|
86
74
|
)
|
87
75
|
end
|
@@ -101,9 +89,8 @@ module Vapi
|
|
101
89
|
# @return [Void]
|
102
90
|
def self.validate_raw(obj:)
|
103
91
|
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
104
|
-
obj.
|
105
|
-
obj.
|
106
|
-
obj.vector_store_provider_id&.is_a?(String) != false || raise("Passed value for field obj.vector_store_provider_id is not the expected type, validation failed.")
|
92
|
+
obj.search_plan.nil? || Vapi::TrieveKnowledgeBaseSearchPlan.validate_raw(obj: obj.search_plan)
|
93
|
+
obj.create_plan.nil? || Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan.validate_raw(obj: obj.create_plan)
|
107
94
|
end
|
108
95
|
end
|
109
96
|
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "trieve_knowledge_base_create"
|
5
|
+
require_relative "trieve_knowledge_base_import"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
# This is the plan if you want us to create/import a new vector store using
|
9
|
+
# Trieve.
|
10
|
+
class UpdateTrieveKnowledgeBaseDtoCreatePlan
|
11
|
+
# @return [Object]
|
12
|
+
attr_reader :member
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :discriminant
|
15
|
+
|
16
|
+
private_class_method :new
|
17
|
+
alias kind_of? is_a?
|
18
|
+
|
19
|
+
# @param member [Object]
|
20
|
+
# @param discriminant [String]
|
21
|
+
# @return [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan]
|
22
|
+
def initialize(member:, discriminant:)
|
23
|
+
@member = member
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of
|
28
|
+
# UpdateTrieveKnowledgeBaseDtoCreatePlan
|
29
|
+
#
|
30
|
+
# @param json_object [String]
|
31
|
+
# @return [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
member = case struct.type
|
35
|
+
when "create"
|
36
|
+
Vapi::TrieveKnowledgeBaseCreate.from_json(json_object: json_object)
|
37
|
+
when "import"
|
38
|
+
Vapi::TrieveKnowledgeBaseImport.from_json(json_object: json_object)
|
39
|
+
else
|
40
|
+
Vapi::TrieveKnowledgeBaseCreate.from_json(json_object: json_object)
|
41
|
+
end
|
42
|
+
new(member: member, discriminant: struct.type)
|
43
|
+
end
|
44
|
+
|
45
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
def to_json(*_args)
|
49
|
+
case @discriminant
|
50
|
+
when "create"
|
51
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
52
|
+
when "import"
|
53
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
54
|
+
else
|
55
|
+
{ "type": @discriminant, value: @member }.to_json
|
56
|
+
end
|
57
|
+
@member.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
|
+
case obj.type
|
68
|
+
when "create"
|
69
|
+
Vapi::TrieveKnowledgeBaseCreate.validate_raw(obj: obj)
|
70
|
+
when "import"
|
71
|
+
Vapi::TrieveKnowledgeBaseImport.validate_raw(obj: obj)
|
72
|
+
else
|
73
|
+
raise("Passed value matched no type within the union, validation failed.")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Boolean]
|
81
|
+
def is_a?(obj)
|
82
|
+
@member.is_a?(obj)
|
83
|
+
end
|
84
|
+
|
85
|
+
# @param member [Vapi::TrieveKnowledgeBaseCreate]
|
86
|
+
# @return [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan]
|
87
|
+
def self.create(member:)
|
88
|
+
new(member: member, discriminant: "create")
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param member [Vapi::TrieveKnowledgeBaseImport]
|
92
|
+
# @return [Vapi::UpdateTrieveKnowledgeBaseDtoCreatePlan]
|
93
|
+
def self.import(member:)
|
94
|
+
new(member: member, discriminant: "import")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_workflow_dto_nodes_item"
|
4
|
+
require_relative "edge"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class UpdateWorkflowDto
|
10
|
+
# @return [Array<Vapi::UpdateWorkflowDtoNodesItem>]
|
11
|
+
attr_reader :nodes
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :name
|
14
|
+
# @return [Array<Vapi::Edge>]
|
15
|
+
attr_reader :edges
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param nodes [Array<Vapi::UpdateWorkflowDtoNodesItem>]
|
25
|
+
# @param name [String]
|
26
|
+
# @param edges [Array<Vapi::Edge>]
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [Vapi::UpdateWorkflowDto]
|
29
|
+
def initialize(nodes: OMIT, name: OMIT, edges: OMIT, additional_properties: nil)
|
30
|
+
@nodes = nodes if nodes != OMIT
|
31
|
+
@name = name if name != OMIT
|
32
|
+
@edges = edges if edges != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "nodes": nodes, "name": name, "edges": edges }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of UpdateWorkflowDto
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [Vapi::UpdateWorkflowDto]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
nodes = parsed_json["nodes"]&.map do |item|
|
47
|
+
item = item.to_json
|
48
|
+
Vapi::UpdateWorkflowDtoNodesItem.from_json(json_object: item)
|
49
|
+
end
|
50
|
+
name = parsed_json["name"]
|
51
|
+
edges = parsed_json["edges"]&.map do |item|
|
52
|
+
item = item.to_json
|
53
|
+
Vapi::Edge.from_json(json_object: item)
|
54
|
+
end
|
55
|
+
new(
|
56
|
+
nodes: nodes,
|
57
|
+
name: name,
|
58
|
+
edges: edges,
|
59
|
+
additional_properties: struct
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Serialize an instance of UpdateWorkflowDto to a JSON object
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
def to_json(*_args)
|
67
|
+
@_field_set&.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# hash and check each fields type against the current object's property
|
72
|
+
# definitions.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.nodes&.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.")
|
78
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
79
|
+
obj.edges&.is_a?(Array) != false || raise("Passed value for field obj.edges is not the expected type, validation failed.")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "say"
|
5
|
+
require_relative "gather"
|
6
|
+
require_relative "create_workflow_dto"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class UpdateWorkflowDtoNodesItem
|
10
|
+
# Deserialize a JSON object to an instance of UpdateWorkflowDtoNodesItem
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Vapi::UpdateWorkflowDtoNodesItem]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
Vapi::Say.validate_raw(obj: struct)
|
18
|
+
return Vapi::Say.from_json(json_object: struct) unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Vapi::Gather.validate_raw(obj: struct)
|
26
|
+
return Vapi::Gather.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
begin
|
33
|
+
struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
34
|
+
return struct unless struct.nil?
|
35
|
+
|
36
|
+
return nil
|
37
|
+
rescue StandardError
|
38
|
+
# noop
|
39
|
+
end
|
40
|
+
begin
|
41
|
+
Vapi::CreateWorkflowDto.validate_raw(obj: struct)
|
42
|
+
return Vapi::CreateWorkflowDto.from_json(json_object: struct) unless struct.nil?
|
43
|
+
|
44
|
+
return nil
|
45
|
+
rescue StandardError
|
46
|
+
# noop
|
47
|
+
end
|
48
|
+
struct
|
49
|
+
end
|
50
|
+
|
51
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
52
|
+
# hash and check each fields type against the current object's property
|
53
|
+
# definitions.
|
54
|
+
#
|
55
|
+
# @param obj [Object]
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_raw(obj:)
|
58
|
+
begin
|
59
|
+
return Vapi::Say.validate_raw(obj: obj)
|
60
|
+
rescue StandardError
|
61
|
+
# noop
|
62
|
+
end
|
63
|
+
begin
|
64
|
+
return Vapi::Gather.validate_raw(obj: obj)
|
65
|
+
rescue StandardError
|
66
|
+
# noop
|
67
|
+
end
|
68
|
+
begin
|
69
|
+
return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
70
|
+
rescue StandardError
|
71
|
+
# noop
|
72
|
+
end
|
73
|
+
begin
|
74
|
+
return Vapi::CreateWorkflowDto.validate_raw(obj: obj)
|
75
|
+
rescue StandardError
|
76
|
+
# noop
|
77
|
+
end
|
78
|
+
raise("Passed value matched no type within the union, validation failed.")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -4,6 +4,7 @@ require_relative "open_ai_message"
|
|
4
4
|
require_relative "vapi_model_tools_item"
|
5
5
|
require_relative "create_custom_knowledge_base_dto"
|
6
6
|
require_relative "vapi_model_steps_item"
|
7
|
+
require_relative "workflow"
|
7
8
|
require "ostruct"
|
8
9
|
require "json"
|
9
10
|
|
@@ -25,6 +26,12 @@ module Vapi
|
|
25
26
|
attr_reader :knowledge_base_id
|
26
27
|
# @return [Array<Vapi::VapiModelStepsItem>]
|
27
28
|
attr_reader :steps
|
29
|
+
# @return [String] This is the workflow that will be used for the call. To use a transient
|
30
|
+
# workflow, use `workflow` instead.
|
31
|
+
attr_reader :workflow_id
|
32
|
+
# @return [Vapi::Workflow] This is the workflow that will be used for the call. To use an existing
|
33
|
+
# workflow, use `workflowId` instead.
|
34
|
+
attr_reader :workflow
|
28
35
|
# @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
|
29
36
|
attr_reader :model
|
30
37
|
# @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage
|
@@ -63,6 +70,10 @@ module Vapi
|
|
63
70
|
# @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base.
|
64
71
|
# @param knowledge_base_id [String] This is the ID of the knowledge base the model will use.
|
65
72
|
# @param steps [Array<Vapi::VapiModelStepsItem>]
|
73
|
+
# @param workflow_id [String] This is the workflow that will be used for the call. To use a transient
|
74
|
+
# workflow, use `workflow` instead.
|
75
|
+
# @param workflow [Vapi::Workflow] This is the workflow that will be used for the call. To use an existing
|
76
|
+
# workflow, use `workflowId` instead.
|
66
77
|
# @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
|
67
78
|
# @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage
|
68
79
|
# caching for lower latency.
|
@@ -81,13 +92,15 @@ module Vapi
|
|
81
92
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
82
93
|
# @return [Vapi::VapiModel]
|
83
94
|
def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT,
|
84
|
-
steps: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil)
|
95
|
+
steps: OMIT, workflow_id: OMIT, workflow: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil)
|
85
96
|
@messages = messages if messages != OMIT
|
86
97
|
@tools = tools if tools != OMIT
|
87
98
|
@tool_ids = tool_ids if tool_ids != OMIT
|
88
99
|
@knowledge_base = knowledge_base if knowledge_base != OMIT
|
89
100
|
@knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT
|
90
101
|
@steps = steps if steps != OMIT
|
102
|
+
@workflow_id = workflow_id if workflow_id != OMIT
|
103
|
+
@workflow = workflow if workflow != OMIT
|
91
104
|
@model = model
|
92
105
|
@temperature = temperature if temperature != OMIT
|
93
106
|
@max_tokens = max_tokens if max_tokens != OMIT
|
@@ -101,6 +114,8 @@ module Vapi
|
|
101
114
|
"knowledgeBase": knowledge_base,
|
102
115
|
"knowledgeBaseId": knowledge_base_id,
|
103
116
|
"steps": steps,
|
117
|
+
"workflowId": workflow_id,
|
118
|
+
"workflow": workflow,
|
104
119
|
"model": model,
|
105
120
|
"temperature": temperature,
|
106
121
|
"maxTokens": max_tokens,
|
@@ -138,6 +153,13 @@ module Vapi
|
|
138
153
|
item = item.to_json
|
139
154
|
Vapi::VapiModelStepsItem.from_json(json_object: item)
|
140
155
|
end
|
156
|
+
workflow_id = parsed_json["workflowId"]
|
157
|
+
if parsed_json["workflow"].nil?
|
158
|
+
workflow = nil
|
159
|
+
else
|
160
|
+
workflow = parsed_json["workflow"].to_json
|
161
|
+
workflow = Vapi::Workflow.from_json(json_object: workflow)
|
162
|
+
end
|
141
163
|
model = parsed_json["model"]
|
142
164
|
temperature = parsed_json["temperature"]
|
143
165
|
max_tokens = parsed_json["maxTokens"]
|
@@ -150,6 +172,8 @@ module Vapi
|
|
150
172
|
knowledge_base: knowledge_base,
|
151
173
|
knowledge_base_id: knowledge_base_id,
|
152
174
|
steps: steps,
|
175
|
+
workflow_id: workflow_id,
|
176
|
+
workflow: workflow,
|
153
177
|
model: model,
|
154
178
|
temperature: temperature,
|
155
179
|
max_tokens: max_tokens,
|
@@ -179,6 +203,8 @@ module Vapi
|
|
179
203
|
obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base)
|
180
204
|
obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.")
|
181
205
|
obj.steps&.is_a?(Array) != false || raise("Passed value for field obj.steps is not the expected type, validation failed.")
|
206
|
+
obj.workflow_id&.is_a?(String) != false || raise("Passed value for field obj.workflow_id is not the expected type, validation failed.")
|
207
|
+
obj.workflow.nil? || Vapi::Workflow.validate_raw(obj: obj.workflow)
|
182
208
|
obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
|
183
209
|
obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.")
|
184
210
|
obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.")
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_nodes_item"
|
4
|
+
require "date"
|
5
|
+
require_relative "edge"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class Workflow
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :type
|
13
|
+
# @return [Array<Vapi::WorkflowNodesItem>]
|
14
|
+
attr_reader :nodes
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :id
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :org_id
|
19
|
+
# @return [DateTime]
|
20
|
+
attr_reader :created_at
|
21
|
+
# @return [DateTime]
|
22
|
+
attr_reader :updated_at
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :name
|
25
|
+
# @return [Array<Vapi::Edge>]
|
26
|
+
attr_reader :edges
|
27
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
attr_reader :additional_properties
|
29
|
+
# @return [Object]
|
30
|
+
attr_reader :_field_set
|
31
|
+
protected :_field_set
|
32
|
+
|
33
|
+
OMIT = Object.new
|
34
|
+
|
35
|
+
# @param type [String]
|
36
|
+
# @param nodes [Array<Vapi::WorkflowNodesItem>]
|
37
|
+
# @param id [String]
|
38
|
+
# @param org_id [String]
|
39
|
+
# @param created_at [DateTime]
|
40
|
+
# @param updated_at [DateTime]
|
41
|
+
# @param name [String]
|
42
|
+
# @param edges [Array<Vapi::Edge>]
|
43
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
44
|
+
# @return [Vapi::Workflow]
|
45
|
+
def initialize(type:, nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, additional_properties: nil)
|
46
|
+
@type = type
|
47
|
+
@nodes = nodes
|
48
|
+
@id = id
|
49
|
+
@org_id = org_id
|
50
|
+
@created_at = created_at
|
51
|
+
@updated_at = updated_at
|
52
|
+
@name = name
|
53
|
+
@edges = edges
|
54
|
+
@additional_properties = additional_properties
|
55
|
+
@_field_set = {
|
56
|
+
"type": type,
|
57
|
+
"nodes": nodes,
|
58
|
+
"id": id,
|
59
|
+
"orgId": org_id,
|
60
|
+
"createdAt": created_at,
|
61
|
+
"updatedAt": updated_at,
|
62
|
+
"name": name,
|
63
|
+
"edges": edges
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Deserialize a JSON object to an instance of Workflow
|
68
|
+
#
|
69
|
+
# @param json_object [String]
|
70
|
+
# @return [Vapi::Workflow]
|
71
|
+
def self.from_json(json_object:)
|
72
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
73
|
+
parsed_json = JSON.parse(json_object)
|
74
|
+
type = parsed_json["type"]
|
75
|
+
nodes = parsed_json["nodes"]&.map do |item|
|
76
|
+
item = item.to_json
|
77
|
+
Vapi::WorkflowNodesItem.from_json(json_object: item)
|
78
|
+
end
|
79
|
+
id = parsed_json["id"]
|
80
|
+
org_id = parsed_json["orgId"]
|
81
|
+
created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
|
82
|
+
updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
|
83
|
+
name = parsed_json["name"]
|
84
|
+
edges = parsed_json["edges"]&.map do |item|
|
85
|
+
item = item.to_json
|
86
|
+
Vapi::Edge.from_json(json_object: item)
|
87
|
+
end
|
88
|
+
new(
|
89
|
+
type: type,
|
90
|
+
nodes: nodes,
|
91
|
+
id: id,
|
92
|
+
org_id: org_id,
|
93
|
+
created_at: created_at,
|
94
|
+
updated_at: updated_at,
|
95
|
+
name: name,
|
96
|
+
edges: edges,
|
97
|
+
additional_properties: struct
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Serialize an instance of Workflow to a JSON object
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
def to_json(*_args)
|
105
|
+
@_field_set&.to_json
|
106
|
+
end
|
107
|
+
|
108
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
109
|
+
# hash and check each fields type against the current object's property
|
110
|
+
# definitions.
|
111
|
+
#
|
112
|
+
# @param obj [Object]
|
113
|
+
# @return [Void]
|
114
|
+
def self.validate_raw(obj:)
|
115
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
116
|
+
obj.nodes.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.")
|
117
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
118
|
+
obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
|
119
|
+
obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
|
120
|
+
obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
|
121
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
122
|
+
obj.edges.is_a?(Array) != false || raise("Passed value for field obj.edges is not the expected type, validation failed.")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "say"
|
5
|
+
require_relative "gather"
|
6
|
+
require_relative "create_workflow_dto"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class WorkflowNodesItem
|
10
|
+
# Deserialize a JSON object to an instance of WorkflowNodesItem
|
11
|
+
#
|
12
|
+
# @param json_object [String]
|
13
|
+
# @return [Vapi::WorkflowNodesItem]
|
14
|
+
def self.from_json(json_object:)
|
15
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
16
|
+
begin
|
17
|
+
Vapi::Say.validate_raw(obj: struct)
|
18
|
+
return Vapi::Say.from_json(json_object: struct) unless struct.nil?
|
19
|
+
|
20
|
+
return nil
|
21
|
+
rescue StandardError
|
22
|
+
# noop
|
23
|
+
end
|
24
|
+
begin
|
25
|
+
Vapi::Gather.validate_raw(obj: struct)
|
26
|
+
return Vapi::Gather.from_json(json_object: struct) unless struct.nil?
|
27
|
+
|
28
|
+
return nil
|
29
|
+
rescue StandardError
|
30
|
+
# noop
|
31
|
+
end
|
32
|
+
begin
|
33
|
+
struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
|
34
|
+
return struct unless struct.nil?
|
35
|
+
|
36
|
+
return nil
|
37
|
+
rescue StandardError
|
38
|
+
# noop
|
39
|
+
end
|
40
|
+
begin
|
41
|
+
Vapi::CreateWorkflowDto.validate_raw(obj: struct)
|
42
|
+
return Vapi::CreateWorkflowDto.from_json(json_object: struct) unless struct.nil?
|
43
|
+
|
44
|
+
return nil
|
45
|
+
rescue StandardError
|
46
|
+
# noop
|
47
|
+
end
|
48
|
+
struct
|
49
|
+
end
|
50
|
+
|
51
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
52
|
+
# hash and check each fields type against the current object's property
|
53
|
+
# definitions.
|
54
|
+
#
|
55
|
+
# @param obj [Object]
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_raw(obj:)
|
58
|
+
begin
|
59
|
+
return Vapi::Say.validate_raw(obj: obj)
|
60
|
+
rescue StandardError
|
61
|
+
# noop
|
62
|
+
end
|
63
|
+
begin
|
64
|
+
return Vapi::Gather.validate_raw(obj: obj)
|
65
|
+
rescue StandardError
|
66
|
+
# noop
|
67
|
+
end
|
68
|
+
begin
|
69
|
+
return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
|
70
|
+
rescue StandardError
|
71
|
+
# noop
|
72
|
+
end
|
73
|
+
begin
|
74
|
+
return Vapi::CreateWorkflowDto.validate_raw(obj: obj)
|
75
|
+
rescue StandardError
|
76
|
+
# noop
|
77
|
+
end
|
78
|
+
raise("Passed value matched no type within the union, validation failed.")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|