vapi_server_sdk 0.3.0 → 0.5.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 +83 -12
- data/lib/vapi_server_sdk/analytics/client.rb +41 -26
- data/lib/vapi_server_sdk/assistants/client.rb +84 -84
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/blocks/client.rb +0 -70
- data/lib/vapi_server_sdk/calls/client.rb +110 -76
- 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 +15 -46
- 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 +136 -78
- data/lib/vapi_server_sdk/test_suite_runs/client.rb +328 -0
- data/lib/vapi_server_sdk/test_suite_runs/types/test_suite_run_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/test_suite_tests/client.rb +331 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_create_request.rb +81 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb +82 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_update_request.rb +81 -0
- data/lib/vapi_server_sdk/test_suites/client.rb +338 -0
- data/lib/vapi_server_sdk/test_suites/types/test_suite_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/tools/client.rb +0 -70
- data/lib/vapi_server_sdk/types/ai_edge_condition.rb +55 -0
- data/lib/vapi_server_sdk/types/analytics_operation_column.rb +1 -0
- data/lib/vapi_server_sdk/types/analytics_operation_operation.rb +1 -0
- data/lib/vapi_server_sdk/types/analytics_query.rb +4 -3
- data/lib/vapi_server_sdk/types/analytics_query_table.rb +9 -0
- data/lib/vapi_server_sdk/types/api_request.rb +165 -0
- data/lib/vapi_server_sdk/types/api_request_method.rb +8 -0
- data/lib/vapi_server_sdk/types/api_request_mode.rb +10 -0
- data/lib/vapi_server_sdk/types/artifact.rb +12 -2
- data/lib/vapi_server_sdk/types/artifact_plan.rb +56 -8
- data/lib/vapi_server_sdk/types/assistant.rb +27 -13
- data/lib/vapi_server_sdk/types/assistant_hook_action_base.rb +47 -0
- data/lib/vapi_server_sdk/types/assistant_hook_filter.rb +72 -0
- data/lib/vapi_server_sdk/types/assistant_hooks.rb +82 -0
- data/lib/vapi_server_sdk/types/assistant_overrides.rb +28 -14
- data/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/types/assistant_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/types/azure_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb +1 -0
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/backoff_plan.rb +80 -0
- 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/byo_phone_number.rb +10 -1
- data/lib/vapi_server_sdk/types/byo_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/call_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls.rb +69 -0
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls_emotion.rb +26 -0
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls_speed.rb +11 -0
- data/lib/vapi_server_sdk/types/cartesia_voice.rb +24 -10
- data/lib/vapi_server_sdk/types/chat_completion_message.rb +80 -0
- data/lib/vapi_server_sdk/types/chat_completion_message_metadata.rb +94 -0
- data/lib/vapi_server_sdk/types/chat_completions_dto.rb +84 -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_inbound_message_transfer.rb +13 -3
- data/lib/vapi_server_sdk/types/client_message_conversation_update.rb +15 -2
- data/lib/vapi_server_sdk/types/client_message_hang.rb +22 -4
- data/lib/vapi_server_sdk/types/client_message_language_change_detected.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_message.rb +165 -181
- data/lib/vapi_server_sdk/types/client_message_metadata.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_model_output.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_speech_update.rb +11 -2
- data/lib/vapi_server_sdk/types/client_message_tool_calls.rb +15 -2
- data/lib/vapi_server_sdk/types/client_message_tool_calls_result.rb +15 -3
- 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/client_message_transcript.rb +12 -2
- data/lib/vapi_server_sdk/types/client_message_transcript_type.rb +10 -0
- data/lib/vapi_server_sdk/types/client_message_transfer_update.rb +11 -1
- data/lib/vapi_server_sdk/types/client_message_user_interrupted.rb +14 -4
- data/lib/vapi_server_sdk/types/client_message_voice_input.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_workflow_node_started.rb +67 -0
- data/lib/vapi_server_sdk/types/compliance_plan.rb +77 -0
- 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_assistant_dto.rb +28 -14
- data/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb +1 -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_models_item.rb +1 -0
- 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_test_suite_test_voice_dto.rb +90 -0
- 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_vapi_phone_number_dto.rb +12 -4
- data/lib/vapi_server_sdk/types/create_workflow_dto.rb +80 -0
- data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +133 -0
- data/lib/vapi_server_sdk/types/custom_knowledge_base.rb +2 -4
- data/lib/vapi_server_sdk/types/deep_seek_model.rb +4 -3
- data/lib/vapi_server_sdk/types/deep_seek_model_model.rb +9 -0
- data/lib/vapi_server_sdk/types/deepgram_transcriber.rb +28 -2
- data/lib/vapi_server_sdk/types/deepgram_voice.rb +22 -2
- data/lib/vapi_server_sdk/types/edge.rb +87 -0
- data/lib/vapi_server_sdk/types/edge_condition.rb +107 -0
- data/lib/vapi_server_sdk/types/failed_edge_condition.rb +47 -0
- data/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb +24 -9
- data/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb +17 -2
- data/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb +22 -20
- data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/format_plan.rb +22 -2
- data/lib/vapi_server_sdk/types/format_plan_formatters_enabled_item.rb +22 -0
- data/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +1 -10
- data/lib/vapi_server_sdk/types/gather.rb +143 -0
- data/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/google_model_model.rb +4 -0
- data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -0
- data/lib/vapi_server_sdk/types/hangup.rb +67 -0
- data/lib/vapi_server_sdk/types/hook.rb +70 -0
- data/lib/vapi_server_sdk/types/hook_on.rb +9 -0
- data/lib/vapi_server_sdk/types/invite_user_dto.rb +11 -2
- data/lib/vapi_server_sdk/types/json_schema.rb +37 -2
- data/lib/vapi_server_sdk/types/log.rb +18 -18
- data/lib/vapi_server_sdk/types/logic_edge_condition.rb +55 -0
- data/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/message_plan.rb +12 -2
- data/lib/vapi_server_sdk/types/open_ai_model.rb +1 -9
- data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +2 -0
- data/lib/vapi_server_sdk/types/open_ai_model_model.rb +2 -0
- data/lib/vapi_server_sdk/types/play_ht_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/rime_ai_voice_id_enum.rb +22 -20
- data/lib/vapi_server_sdk/types/rime_ai_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/say.rb +81 -0
- data/lib/vapi_server_sdk/types/say_hook.rb +81 -0
- data/lib/vapi_server_sdk/types/server.rb +17 -2
- data/lib/vapi_server_sdk/types/server_message_assistant_request.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_conversation_update.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/server_message_hang.rb +20 -2
- data/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb +14 -2
- data/lib/vapi_server_sdk/types/server_message_language_change_detected.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_message.rb +212 -237
- data/lib/vapi_server_sdk/types/server_message_model_output.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_phone_call_control.rb +18 -2
- data/lib/vapi_server_sdk/types/server_message_speech_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_status_update.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/server_message_tool_calls.rb +10 -2
- 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/server_message_transcript.rb +13 -2
- data/lib/vapi_server_sdk/types/server_message_transcript_type.rb +10 -0
- data/lib/vapi_server_sdk/types/server_message_transfer_destination_request.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_transfer_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_user_interrupted.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_voice_input.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_voice_request.rb +50 -2
- data/lib/vapi_server_sdk/types/stop_speaking_plan.rb +27 -2
- data/lib/vapi_server_sdk/types/subscription.rb +44 -14
- data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
- data/lib/vapi_server_sdk/types/test_suite.rb +104 -0
- data/lib/vapi_server_sdk/types/test_suite_run.rb +127 -0
- data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai.rb +80 -0
- data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai_result.rb +9 -0
- data/lib/vapi_server_sdk/types/test_suite_run_status.rb +10 -0
- data/lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb +75 -0
- data/lib/vapi_server_sdk/types/{analytics_query_dto.rb → test_suite_run_test_attempt_call.rb} +19 -17
- data/lib/vapi_server_sdk/types/test_suite_run_test_result.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suite_runs_paginated_response.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suite_test_scorer_ai.rb +65 -0
- data/lib/vapi_server_sdk/types/test_suite_test_voice.rb +132 -0
- data/lib/vapi_server_sdk/types/test_suite_tests_paginated_response.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suites_paginated_response.rb +75 -0
- 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/time_range_step.rb +1 -0
- data/lib/vapi_server_sdk/types/tool_message_start.rb +18 -2
- data/lib/vapi_server_sdk/types/transfer.rb +74 -0
- data/lib/vapi_server_sdk/types/transfer_assistant_hook_action.rb +75 -0
- data/lib/vapi_server_sdk/types/{buy_phone_number_dto_fallback_destination.rb → transfer_assistant_hook_action_destination.rb} +9 -12
- data/lib/vapi_server_sdk/types/transfer_destination_assistant.rb +46 -0
- data/lib/vapi_server_sdk/types/transfer_plan.rb +37 -1
- data/lib/vapi_server_sdk/types/transfer_plan_mode.rb +4 -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} +21 -12
- 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/twilio_phone_number.rb +11 -2
- data/lib/vapi_server_sdk/types/twilio_phone_number_status.rb +10 -0
- 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_models_item.rb +1 -0
- 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_test_suite_test_voice_dto.rb +90 -0
- 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/vapi_model.rb +27 -1
- data/lib/vapi_server_sdk/types/vapi_phone_number.rb +29 -4
- data/lib/vapi_server_sdk/types/vapi_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/vonage_phone_number.rb +11 -2
- data/lib/vapi_server_sdk/types/vonage_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/workflow.rb +117 -0
- data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +133 -0
- data/lib/vapi_server_sdk/types/xai_model.rb +4 -3
- data/lib/vapi_server_sdk/types/xai_model_model.rb +10 -0
- data/lib/vapi_server_sdk.rb +21 -0
- metadata +85 -11
- data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +0 -147
- data/lib/vapi_server_sdk/types/org_with_org_user.rb +0 -262
- data/lib/vapi_server_sdk/types/org_with_org_user_channel.rb +0 -10
- data/lib/vapi_server_sdk/types/org_with_org_user_role.rb +0 -9
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "cartesia_voice_model"
|
4
4
|
require_relative "cartesia_voice_language"
|
5
|
+
require_relative "cartesia_experimental_controls"
|
5
6
|
require_relative "chunk_plan"
|
6
7
|
require_relative "fallback_plan"
|
7
8
|
require "ostruct"
|
@@ -9,17 +10,19 @@ require "json"
|
|
9
10
|
|
10
11
|
module Vapi
|
11
12
|
class CartesiaVoice
|
13
|
+
# @return [String] The ID of the particular voice you want to use.
|
14
|
+
attr_reader :voice_id
|
12
15
|
# @return [Vapi::CartesiaVoiceModel] This is the model that will be used. This is optional and will default to the
|
13
16
|
# correct model for the voiceId.
|
14
17
|
attr_reader :model
|
15
18
|
# @return [Vapi::CartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the
|
16
19
|
# correct language for the voiceId.
|
17
20
|
attr_reader :language
|
21
|
+
# @return [Vapi::CartesiaExperimentalControls] Experimental controls for Cartesia voice generation
|
22
|
+
attr_reader :experimental_controls
|
18
23
|
# @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
|
19
24
|
# provider.
|
20
25
|
attr_reader :chunk_plan
|
21
|
-
# @return [String] This is the provider-specific ID that will be used.
|
22
|
-
attr_reader :voice_id
|
23
26
|
# @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary
|
24
27
|
# voice provider fails.
|
25
28
|
attr_reader :fallback_plan
|
@@ -31,30 +34,33 @@ module Vapi
|
|
31
34
|
|
32
35
|
OMIT = Object.new
|
33
36
|
|
37
|
+
# @param voice_id [String] The ID of the particular voice you want to use.
|
34
38
|
# @param model [Vapi::CartesiaVoiceModel] This is the model that will be used. This is optional and will default to the
|
35
39
|
# correct model for the voiceId.
|
36
40
|
# @param language [Vapi::CartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the
|
37
41
|
# correct language for the voiceId.
|
42
|
+
# @param experimental_controls [Vapi::CartesiaExperimentalControls] Experimental controls for Cartesia voice generation
|
38
43
|
# @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
|
39
44
|
# provider.
|
40
|
-
# @param voice_id [String] This is the provider-specific ID that will be used.
|
41
45
|
# @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary
|
42
46
|
# voice provider fails.
|
43
47
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
44
48
|
# @return [Vapi::CartesiaVoice]
|
45
|
-
def initialize(voice_id:, model: OMIT, language: OMIT,
|
46
|
-
additional_properties: nil)
|
49
|
+
def initialize(voice_id:, model: OMIT, language: OMIT, experimental_controls: OMIT, chunk_plan: OMIT,
|
50
|
+
fallback_plan: OMIT, additional_properties: nil)
|
51
|
+
@voice_id = voice_id
|
47
52
|
@model = model if model != OMIT
|
48
53
|
@language = language if language != OMIT
|
54
|
+
@experimental_controls = experimental_controls if experimental_controls != OMIT
|
49
55
|
@chunk_plan = chunk_plan if chunk_plan != OMIT
|
50
|
-
@voice_id = voice_id
|
51
56
|
@fallback_plan = fallback_plan if fallback_plan != OMIT
|
52
57
|
@additional_properties = additional_properties
|
53
58
|
@_field_set = {
|
59
|
+
"voiceId": voice_id,
|
54
60
|
"model": model,
|
55
61
|
"language": language,
|
62
|
+
"experimentalControls": experimental_controls,
|
56
63
|
"chunkPlan": chunk_plan,
|
57
|
-
"voiceId": voice_id,
|
58
64
|
"fallbackPlan": fallback_plan
|
59
65
|
}.reject do |_k, v|
|
60
66
|
v == OMIT
|
@@ -68,15 +74,21 @@ module Vapi
|
|
68
74
|
def self.from_json(json_object:)
|
69
75
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
70
76
|
parsed_json = JSON.parse(json_object)
|
77
|
+
voice_id = parsed_json["voiceId"]
|
71
78
|
model = parsed_json["model"]
|
72
79
|
language = parsed_json["language"]
|
80
|
+
if parsed_json["experimentalControls"].nil?
|
81
|
+
experimental_controls = nil
|
82
|
+
else
|
83
|
+
experimental_controls = parsed_json["experimentalControls"].to_json
|
84
|
+
experimental_controls = Vapi::CartesiaExperimentalControls.from_json(json_object: experimental_controls)
|
85
|
+
end
|
73
86
|
if parsed_json["chunkPlan"].nil?
|
74
87
|
chunk_plan = nil
|
75
88
|
else
|
76
89
|
chunk_plan = parsed_json["chunkPlan"].to_json
|
77
90
|
chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan)
|
78
91
|
end
|
79
|
-
voice_id = parsed_json["voiceId"]
|
80
92
|
if parsed_json["fallbackPlan"].nil?
|
81
93
|
fallback_plan = nil
|
82
94
|
else
|
@@ -84,10 +96,11 @@ module Vapi
|
|
84
96
|
fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan)
|
85
97
|
end
|
86
98
|
new(
|
99
|
+
voice_id: voice_id,
|
87
100
|
model: model,
|
88
101
|
language: language,
|
102
|
+
experimental_controls: experimental_controls,
|
89
103
|
chunk_plan: chunk_plan,
|
90
|
-
voice_id: voice_id,
|
91
104
|
fallback_plan: fallback_plan,
|
92
105
|
additional_properties: struct
|
93
106
|
)
|
@@ -107,10 +120,11 @@ module Vapi
|
|
107
120
|
# @param obj [Object]
|
108
121
|
# @return [Void]
|
109
122
|
def self.validate_raw(obj:)
|
123
|
+
obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
|
110
124
|
obj.model&.is_a?(Vapi::CartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
|
111
125
|
obj.language&.is_a?(Vapi::CartesiaVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
|
126
|
+
obj.experimental_controls.nil? || Vapi::CartesiaExperimentalControls.validate_raw(obj: obj.experimental_controls)
|
112
127
|
obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
|
113
|
-
obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
|
114
128
|
obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan)
|
115
129
|
end
|
116
130
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_completion_message_metadata"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
class ChatCompletionMessage
|
9
|
+
# @return [Hash{String => Object}]
|
10
|
+
attr_reader :role
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :content
|
13
|
+
# @return [Vapi::ChatCompletionMessageMetadata]
|
14
|
+
attr_reader :metadata
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
22
|
+
|
23
|
+
# @param role [Hash{String => Object}]
|
24
|
+
# @param content [String]
|
25
|
+
# @param metadata [Vapi::ChatCompletionMessageMetadata]
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
# @return [Vapi::ChatCompletionMessage]
|
28
|
+
def initialize(role:, content: OMIT, metadata: OMIT, additional_properties: nil)
|
29
|
+
@role = role
|
30
|
+
@content = content if content != OMIT
|
31
|
+
@metadata = metadata if metadata != OMIT
|
32
|
+
@additional_properties = additional_properties
|
33
|
+
@_field_set = { "role": role, "content": content, "metadata": metadata }.reject do |_k, v|
|
34
|
+
v == OMIT
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Deserialize a JSON object to an instance of ChatCompletionMessage
|
39
|
+
#
|
40
|
+
# @param json_object [String]
|
41
|
+
# @return [Vapi::ChatCompletionMessage]
|
42
|
+
def self.from_json(json_object:)
|
43
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
44
|
+
parsed_json = JSON.parse(json_object)
|
45
|
+
role = parsed_json["role"]
|
46
|
+
content = parsed_json["content"]
|
47
|
+
if parsed_json["metadata"].nil?
|
48
|
+
metadata = nil
|
49
|
+
else
|
50
|
+
metadata = parsed_json["metadata"].to_json
|
51
|
+
metadata = Vapi::ChatCompletionMessageMetadata.from_json(json_object: metadata)
|
52
|
+
end
|
53
|
+
new(
|
54
|
+
role: role,
|
55
|
+
content: content,
|
56
|
+
metadata: metadata,
|
57
|
+
additional_properties: struct
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Serialize an instance of ChatCompletionMessage to a JSON object
|
62
|
+
#
|
63
|
+
# @return [String]
|
64
|
+
def to_json(*_args)
|
65
|
+
@_field_set&.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
69
|
+
# hash and check each fields type against the current object's property
|
70
|
+
# definitions.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Void]
|
74
|
+
def self.validate_raw(obj:)
|
75
|
+
obj.role.is_a?(Hash) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
|
76
|
+
obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.")
|
77
|
+
obj.metadata.nil? || Vapi::ChatCompletionMessageMetadata.validate_raw(obj: obj.metadata)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class ChatCompletionMessageMetadata
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :task_name
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :task_type
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :task_output
|
14
|
+
# @return [Hash{String => Object}]
|
15
|
+
attr_reader :task_state
|
16
|
+
# @return [Array<String>]
|
17
|
+
attr_reader :node_trace
|
18
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
attr_reader :additional_properties
|
20
|
+
# @return [Object]
|
21
|
+
attr_reader :_field_set
|
22
|
+
protected :_field_set
|
23
|
+
|
24
|
+
OMIT = Object.new
|
25
|
+
|
26
|
+
# @param task_name [String]
|
27
|
+
# @param task_type [String]
|
28
|
+
# @param task_output [String]
|
29
|
+
# @param task_state [Hash{String => Object}]
|
30
|
+
# @param node_trace [Array<String>]
|
31
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
32
|
+
# @return [Vapi::ChatCompletionMessageMetadata]
|
33
|
+
def initialize(task_name:, task_type:, task_output:, task_state: OMIT, node_trace: OMIT, additional_properties: nil)
|
34
|
+
@task_name = task_name
|
35
|
+
@task_type = task_type
|
36
|
+
@task_output = task_output
|
37
|
+
@task_state = task_state if task_state != OMIT
|
38
|
+
@node_trace = node_trace if node_trace != OMIT
|
39
|
+
@additional_properties = additional_properties
|
40
|
+
@_field_set = {
|
41
|
+
"taskName": task_name,
|
42
|
+
"taskType": task_type,
|
43
|
+
"taskOutput": task_output,
|
44
|
+
"taskState": task_state,
|
45
|
+
"nodeTrace": node_trace
|
46
|
+
}.reject do |_k, v|
|
47
|
+
v == OMIT
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Deserialize a JSON object to an instance of ChatCompletionMessageMetadata
|
52
|
+
#
|
53
|
+
# @param json_object [String]
|
54
|
+
# @return [Vapi::ChatCompletionMessageMetadata]
|
55
|
+
def self.from_json(json_object:)
|
56
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
57
|
+
parsed_json = JSON.parse(json_object)
|
58
|
+
task_name = parsed_json["taskName"]
|
59
|
+
task_type = parsed_json["taskType"]
|
60
|
+
task_output = parsed_json["taskOutput"]
|
61
|
+
task_state = parsed_json["taskState"]
|
62
|
+
node_trace = parsed_json["nodeTrace"]
|
63
|
+
new(
|
64
|
+
task_name: task_name,
|
65
|
+
task_type: task_type,
|
66
|
+
task_output: task_output,
|
67
|
+
task_state: task_state,
|
68
|
+
node_trace: node_trace,
|
69
|
+
additional_properties: struct
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Serialize an instance of ChatCompletionMessageMetadata to a JSON object
|
74
|
+
#
|
75
|
+
# @return [String]
|
76
|
+
def to_json(*_args)
|
77
|
+
@_field_set&.to_json
|
78
|
+
end
|
79
|
+
|
80
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
81
|
+
# hash and check each fields type against the current object's property
|
82
|
+
# definitions.
|
83
|
+
#
|
84
|
+
# @param obj [Object]
|
85
|
+
# @return [Void]
|
86
|
+
def self.validate_raw(obj:)
|
87
|
+
obj.task_name.is_a?(String) != false || raise("Passed value for field obj.task_name is not the expected type, validation failed.")
|
88
|
+
obj.task_type.is_a?(String) != false || raise("Passed value for field obj.task_type is not the expected type, validation failed.")
|
89
|
+
obj.task_output.is_a?(String) != false || raise("Passed value for field obj.task_output is not the expected type, validation failed.")
|
90
|
+
obj.task_state&.is_a?(Hash) != false || raise("Passed value for field obj.task_state is not the expected type, validation failed.")
|
91
|
+
obj.node_trace&.is_a?(Array) != false || raise("Passed value for field obj.node_trace is not the expected type, validation failed.")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_completion_message"
|
4
|
+
require_relative "create_workflow_dto"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class ChatCompletionsDto
|
10
|
+
# @return [Array<Vapi::ChatCompletionMessage>]
|
11
|
+
attr_reader :messages
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :workflow_id
|
14
|
+
# @return [Vapi::CreateWorkflowDto]
|
15
|
+
attr_reader :workflow
|
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 messages [Array<Vapi::ChatCompletionMessage>]
|
25
|
+
# @param workflow_id [String]
|
26
|
+
# @param workflow [Vapi::CreateWorkflowDto]
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [Vapi::ChatCompletionsDto]
|
29
|
+
def initialize(messages:, workflow_id: OMIT, workflow: OMIT, additional_properties: nil)
|
30
|
+
@messages = messages
|
31
|
+
@workflow_id = workflow_id if workflow_id != OMIT
|
32
|
+
@workflow = workflow if workflow != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "messages": messages, "workflowId": workflow_id, "workflow": workflow }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of ChatCompletionsDto
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [Vapi::ChatCompletionsDto]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
messages = parsed_json["messages"]&.map do |item|
|
47
|
+
item = item.to_json
|
48
|
+
Vapi::ChatCompletionMessage.from_json(json_object: item)
|
49
|
+
end
|
50
|
+
workflow_id = parsed_json["workflowId"]
|
51
|
+
if parsed_json["workflow"].nil?
|
52
|
+
workflow = nil
|
53
|
+
else
|
54
|
+
workflow = parsed_json["workflow"].to_json
|
55
|
+
workflow = Vapi::CreateWorkflowDto.from_json(json_object: workflow)
|
56
|
+
end
|
57
|
+
new(
|
58
|
+
messages: messages,
|
59
|
+
workflow_id: workflow_id,
|
60
|
+
workflow: workflow,
|
61
|
+
additional_properties: struct
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Serialize an instance of ChatCompletionsDto to a JSON object
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
def to_json(*_args)
|
69
|
+
@_field_set&.to_json
|
70
|
+
end
|
71
|
+
|
72
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
73
|
+
# hash and check each fields type against the current object's property
|
74
|
+
# definitions.
|
75
|
+
#
|
76
|
+
# @param obj [Object]
|
77
|
+
# @return [Void]
|
78
|
+
def self.validate_raw(obj:)
|
79
|
+
obj.messages.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
80
|
+
obj.workflow_id&.is_a?(String) != false || raise("Passed value for field obj.workflow_id is not the expected type, validation failed.")
|
81
|
+
obj.workflow.nil? || Vapi::CreateWorkflowDto.validate_raw(obj: obj.workflow)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class ClientInboundMessageEndCall
|
8
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
9
|
+
attr_reader :additional_properties
|
10
|
+
# @return [Object]
|
11
|
+
attr_reader :_field_set
|
12
|
+
protected :_field_set
|
13
|
+
|
14
|
+
OMIT = Object.new
|
15
|
+
|
16
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
# @return [Vapi::ClientInboundMessageEndCall]
|
18
|
+
def initialize(additional_properties: nil)
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
@_field_set = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of ClientInboundMessageEndCall
|
24
|
+
#
|
25
|
+
# @param json_object [String]
|
26
|
+
# @return [Vapi::ClientInboundMessageEndCall]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
new(additional_properties: struct)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Serialize an instance of ClientInboundMessageEndCall to a JSON object
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
def to_json(*_args)
|
36
|
+
@_field_set&.to_json
|
37
|
+
end
|
38
|
+
|
39
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
40
|
+
# hash and check each fields type against the current object's property
|
41
|
+
# definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:); end
|
46
|
+
end
|
47
|
+
end
|
@@ -4,6 +4,7 @@ require "json"
|
|
4
4
|
require_relative "client_inbound_message_add_message"
|
5
5
|
require_relative "client_inbound_message_control"
|
6
6
|
require_relative "client_inbound_message_say"
|
7
|
+
require_relative "client_inbound_message_end_call"
|
7
8
|
require_relative "client_inbound_message_transfer"
|
8
9
|
|
9
10
|
module Vapi
|
@@ -39,6 +40,8 @@ module Vapi
|
|
39
40
|
Vapi::ClientInboundMessageControl.from_json(json_object: json_object)
|
40
41
|
when "say"
|
41
42
|
Vapi::ClientInboundMessageSay.from_json(json_object: json_object)
|
43
|
+
when "end-call"
|
44
|
+
Vapi::ClientInboundMessageEndCall.from_json(json_object: json_object)
|
42
45
|
when "transfer"
|
43
46
|
Vapi::ClientInboundMessageTransfer.from_json(json_object: json_object)
|
44
47
|
else
|
@@ -58,6 +61,8 @@ module Vapi
|
|
58
61
|
{ **@member.to_json, type: @discriminant }.to_json
|
59
62
|
when "say"
|
60
63
|
{ **@member.to_json, type: @discriminant }.to_json
|
64
|
+
when "end-call"
|
65
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
61
66
|
when "transfer"
|
62
67
|
{ **@member.to_json, type: @discriminant }.to_json
|
63
68
|
else
|
@@ -80,6 +85,8 @@ module Vapi
|
|
80
85
|
Vapi::ClientInboundMessageControl.validate_raw(obj: obj)
|
81
86
|
when "say"
|
82
87
|
Vapi::ClientInboundMessageSay.validate_raw(obj: obj)
|
88
|
+
when "end-call"
|
89
|
+
Vapi::ClientInboundMessageEndCall.validate_raw(obj: obj)
|
83
90
|
when "transfer"
|
84
91
|
Vapi::ClientInboundMessageTransfer.validate_raw(obj: obj)
|
85
92
|
else
|
@@ -113,6 +120,12 @@ module Vapi
|
|
113
120
|
new(member: member, discriminant: "say")
|
114
121
|
end
|
115
122
|
|
123
|
+
# @param member [Vapi::ClientInboundMessageEndCall]
|
124
|
+
# @return [Vapi::ClientInboundMessageMessage]
|
125
|
+
def self.end_call(member:)
|
126
|
+
new(member: member, discriminant: "end-call")
|
127
|
+
end
|
128
|
+
|
116
129
|
# @param member [Vapi::ClientInboundMessageTransfer]
|
117
130
|
# @return [Vapi::ClientInboundMessageMessage]
|
118
131
|
def self.transfer(member:)
|
@@ -8,6 +8,8 @@ module Vapi
|
|
8
8
|
class ClientInboundMessageTransfer
|
9
9
|
# @return [Vapi::ClientInboundMessageTransferDestination] This is the destination to transfer the call to.
|
10
10
|
attr_reader :destination
|
11
|
+
# @return [String] This is the content to say.
|
12
|
+
attr_reader :content
|
11
13
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
12
14
|
attr_reader :additional_properties
|
13
15
|
# @return [Object]
|
@@ -17,12 +19,14 @@ module Vapi
|
|
17
19
|
OMIT = Object.new
|
18
20
|
|
19
21
|
# @param destination [Vapi::ClientInboundMessageTransferDestination] This is the destination to transfer the call to.
|
22
|
+
# @param content [String] This is the content to say.
|
20
23
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
24
|
# @return [Vapi::ClientInboundMessageTransfer]
|
22
|
-
def initialize(destination: OMIT, additional_properties: nil)
|
25
|
+
def initialize(destination: OMIT, content: OMIT, additional_properties: nil)
|
23
26
|
@destination = destination if destination != OMIT
|
27
|
+
@content = content if content != OMIT
|
24
28
|
@additional_properties = additional_properties
|
25
|
-
@_field_set = { "destination": destination }.reject do |_k, v|
|
29
|
+
@_field_set = { "destination": destination, "content": content }.reject do |_k, v|
|
26
30
|
v == OMIT
|
27
31
|
end
|
28
32
|
end
|
@@ -40,7 +44,12 @@ module Vapi
|
|
40
44
|
destination = parsed_json["destination"].to_json
|
41
45
|
destination = Vapi::ClientInboundMessageTransferDestination.from_json(json_object: destination)
|
42
46
|
end
|
43
|
-
|
47
|
+
content = parsed_json["content"]
|
48
|
+
new(
|
49
|
+
destination: destination,
|
50
|
+
content: content,
|
51
|
+
additional_properties: struct
|
52
|
+
)
|
44
53
|
end
|
45
54
|
|
46
55
|
# Serialize an instance of ClientInboundMessageTransfer to a JSON object
|
@@ -58,6 +67,7 @@ module Vapi
|
|
58
67
|
# @return [Void]
|
59
68
|
def self.validate_raw(obj:)
|
60
69
|
obj.destination.nil? || Vapi::ClientInboundMessageTransferDestination.validate_raw(obj: obj.destination)
|
70
|
+
obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.")
|
61
71
|
end
|
62
72
|
end
|
63
73
|
end
|
@@ -7,6 +7,9 @@ require "json"
|
|
7
7
|
|
8
8
|
module Vapi
|
9
9
|
class ClientMessageConversationUpdate
|
10
|
+
# @return [String] This is the type of the message. "conversation-update" is sent when an update is
|
11
|
+
# committed to the conversation history.
|
12
|
+
attr_reader :type
|
10
13
|
# @return [Array<Vapi::ClientMessageConversationUpdateMessagesItem>] This is the most up-to-date conversation history at the time the message is
|
11
14
|
# sent.
|
12
15
|
attr_reader :messages
|
@@ -21,17 +24,24 @@ module Vapi
|
|
21
24
|
|
22
25
|
OMIT = Object.new
|
23
26
|
|
27
|
+
# @param type [String] This is the type of the message. "conversation-update" is sent when an update is
|
28
|
+
# committed to the conversation history.
|
24
29
|
# @param messages [Array<Vapi::ClientMessageConversationUpdateMessagesItem>] This is the most up-to-date conversation history at the time the message is
|
25
30
|
# sent.
|
26
31
|
# @param messages_open_ai_formatted [Array<Vapi::OpenAiMessage>] This is the most up-to-date conversation history at the time the message is
|
27
32
|
# sent, formatted for OpenAI.
|
28
33
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
34
|
# @return [Vapi::ClientMessageConversationUpdate]
|
30
|
-
def initialize(messages_open_ai_formatted:, messages: OMIT, additional_properties: nil)
|
35
|
+
def initialize(type:, messages_open_ai_formatted:, messages: OMIT, additional_properties: nil)
|
36
|
+
@type = type
|
31
37
|
@messages = messages if messages != OMIT
|
32
38
|
@messages_open_ai_formatted = messages_open_ai_formatted
|
33
39
|
@additional_properties = additional_properties
|
34
|
-
@_field_set = {
|
40
|
+
@_field_set = {
|
41
|
+
"type": type,
|
42
|
+
"messages": messages,
|
43
|
+
"messagesOpenAIFormatted": messages_open_ai_formatted
|
44
|
+
}.reject do |_k, v|
|
35
45
|
v == OMIT
|
36
46
|
end
|
37
47
|
end
|
@@ -43,6 +53,7 @@ module Vapi
|
|
43
53
|
def self.from_json(json_object:)
|
44
54
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
55
|
parsed_json = JSON.parse(json_object)
|
56
|
+
type = parsed_json["type"]
|
46
57
|
messages = parsed_json["messages"]&.map do |item|
|
47
58
|
item = item.to_json
|
48
59
|
Vapi::ClientMessageConversationUpdateMessagesItem.from_json(json_object: item)
|
@@ -52,6 +63,7 @@ module Vapi
|
|
52
63
|
Vapi::OpenAiMessage.from_json(json_object: item)
|
53
64
|
end
|
54
65
|
new(
|
66
|
+
type: type,
|
55
67
|
messages: messages,
|
56
68
|
messages_open_ai_formatted: messages_open_ai_formatted,
|
57
69
|
additional_properties: struct
|
@@ -72,6 +84,7 @@ module Vapi
|
|
72
84
|
# @param obj [Object]
|
73
85
|
# @return [Void]
|
74
86
|
def self.validate_raw(obj:)
|
87
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
75
88
|
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
76
89
|
obj.messages_open_ai_formatted.is_a?(Array) != false || raise("Passed value for field obj.messages_open_ai_formatted is not the expected type, validation failed.")
|
77
90
|
end
|
@@ -5,6 +5,13 @@ require "json"
|
|
5
5
|
|
6
6
|
module Vapi
|
7
7
|
class ClientMessageHang
|
8
|
+
# @return [String] This is the type of the message. "hang" is sent when the assistant is hanging
|
9
|
+
# due to a delay. The delay can be caused by many factors, such as:
|
10
|
+
# - the model is too slow to respond
|
11
|
+
# - the voice is too slow to respond
|
12
|
+
# - the tool call is still waiting for a response from your server
|
13
|
+
# - etc.
|
14
|
+
attr_reader :type
|
8
15
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
9
16
|
attr_reader :additional_properties
|
10
17
|
# @return [Object]
|
@@ -13,11 +20,18 @@ module Vapi
|
|
13
20
|
|
14
21
|
OMIT = Object.new
|
15
22
|
|
23
|
+
# @param type [String] This is the type of the message. "hang" is sent when the assistant is hanging
|
24
|
+
# due to a delay. The delay can be caused by many factors, such as:
|
25
|
+
# - the model is too slow to respond
|
26
|
+
# - the voice is too slow to respond
|
27
|
+
# - the tool call is still waiting for a response from your server
|
28
|
+
# - etc.
|
16
29
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
30
|
# @return [Vapi::ClientMessageHang]
|
18
|
-
def initialize(additional_properties: nil)
|
31
|
+
def initialize(type:, additional_properties: nil)
|
32
|
+
@type = type
|
19
33
|
@additional_properties = additional_properties
|
20
|
-
@_field_set = {}
|
34
|
+
@_field_set = { "type": type }
|
21
35
|
end
|
22
36
|
|
23
37
|
# Deserialize a JSON object to an instance of ClientMessageHang
|
@@ -26,7 +40,9 @@ module Vapi
|
|
26
40
|
# @return [Vapi::ClientMessageHang]
|
27
41
|
def self.from_json(json_object:)
|
28
42
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
-
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
type = parsed_json["type"]
|
45
|
+
new(type: type, additional_properties: struct)
|
30
46
|
end
|
31
47
|
|
32
48
|
# Serialize an instance of ClientMessageHang to a JSON object
|
@@ -42,6 +58,8 @@ module Vapi
|
|
42
58
|
#
|
43
59
|
# @param obj [Object]
|
44
60
|
# @return [Void]
|
45
|
-
def self.validate_raw(obj:)
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
63
|
+
end
|
46
64
|
end
|
47
65
|
end
|