vapi_server_sdk 0.2.0 → 0.3.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 +129 -62
- data/lib/vapi_server_sdk/assistants/client.rb +15 -2
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item.rb +512 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb +13 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb +13 -0
- data/lib/vapi_server_sdk/blocks/client.rb +7 -166
- data/lib/vapi_server_sdk/blocks/types/blocks_update_request.rb +109 -0
- data/lib/vapi_server_sdk/calls/client.rb +16 -4
- data/lib/vapi_server_sdk/knowledge_bases/client.rb +7 -8
- data/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request.rb +96 -0
- data/lib/vapi_server_sdk/logs/client.rb +84 -0
- data/lib/vapi_server_sdk/phone_numbers/client.rb +7 -69
- data/lib/vapi_server_sdk/phone_numbers/types/phone_numbers_update_request.rb +122 -0
- data/lib/vapi_server_sdk/squads/client.rb +8 -0
- data/lib/vapi_server_sdk/tools/client.rb +7 -91
- data/lib/vapi_server_sdk/tools/types/tools_update_request.rb +200 -0
- data/lib/vapi_server_sdk/types/assistant.rb +19 -1
- data/lib/vapi_server_sdk/types/assistant_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/assistant_model.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides.rb +19 -1
- data/lib/vapi_server_sdk/types/assistant_overrides_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_model.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/azure_blob_storage_bucket_plan.rb +88 -0
- data/lib/vapi_server_sdk/types/azure_credential.rb +22 -5
- data/lib/vapi_server_sdk/types/azure_credential_region.rb +1 -1
- data/lib/vapi_server_sdk/types/azure_credential_service.rb +9 -0
- data/lib/vapi_server_sdk/types/azure_open_ai_credential.rb +9 -1
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +1 -1
- data/lib/vapi_server_sdk/types/azure_speech_transcriber.rb +62 -0
- data/lib/vapi_server_sdk/types/azure_speech_transcriber_language.rb +152 -0
- data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/byo_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/call_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/cartesia_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/cerebras_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/chat_dto.rb +103 -0
- data/lib/vapi_server_sdk/types/{credits_buy_dto.rb → chat_service_response.rb} +9 -17
- data/lib/vapi_server_sdk/types/cloudflare_credential.rb +142 -0
- data/lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb +105 -0
- data/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_assistant_dto.rb +19 -1
- data/lib/vapi_server_sdk/types/create_assistant_dto_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_model.rb +13 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/create_azure_credential_dto.rb +21 -12
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_service.rb +9 -0
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb +10 -9
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb +1 -9
- data/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_cerebras_credential_dto.rb +74 -0
- data/lib/vapi_server_sdk/types/create_cloudflare_credential_dto.rb +101 -0
- data/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_deep_seek_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_groq_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb +2 -15
- data/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_make_credential_dto.rb +2 -15
- data/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_org_dto.rb +25 -25
- data/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb +2 -10
- data/lib/vapi_server_sdk/types/create_smallest_ai_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb +2 -13
- data/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb +2 -11
- data/lib/vapi_server_sdk/types/deep_seek_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/deep_seek_model.rb +177 -0
- data/lib/vapi_server_sdk/types/deep_seek_model_tools_item.rb +159 -0
- data/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb +4 -4
- data/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb +2 -2
- data/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb +13 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice.rb +95 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id.rb +53 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum.rb +31 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config.rb +58 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name.rb +11 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_speech_config.rb +61 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_voice_config.rb +61 -0
- data/lib/vapi_server_sdk/types/google_model.rb +17 -1
- data/lib/vapi_server_sdk/types/google_model_model.rb +2 -0
- data/lib/vapi_server_sdk/types/google_realtime_config.rb +121 -0
- data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -3
- data/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +6 -0
- data/lib/vapi_server_sdk/types/open_ai_model_model.rb +6 -0
- data/lib/vapi_server_sdk/types/open_ai_voice.rb +4 -4
- data/lib/vapi_server_sdk/types/open_ai_voice_id.rb +2 -2
- data/lib/vapi_server_sdk/types/org.rb +25 -25
- data/lib/vapi_server_sdk/types/org_with_org_user.rb +25 -25
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/server_message_status_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/smallest_ai_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice.rb +117 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice_id.rb +53 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice_id_enum.rb +31 -0
- data/lib/vapi_server_sdk/types/subscription.rb +2 -2
- data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
- data/lib/vapi_server_sdk/types/transfer_plan.rb +26 -6
- data/lib/vapi_server_sdk/types/transfer_plan_message.rb +2 -1
- data/lib/vapi_server_sdk/types/twilio_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_azure_credential_dto.rb +24 -14
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_service.rb +9 -0
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb +25 -24
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/update_bash_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_bash_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_byo_phone_number_dto.rb +187 -0
- data/lib/vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb +13 -21
- data/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_cerebras_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_cloudflare_credential_dto.rb +101 -0
- data/lib/vapi_server_sdk/types/update_computer_tool_dto.rb +185 -0
- data/lib/vapi_server_sdk/types/update_computer_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_conversation_block_dto.rb +206 -0
- data/lib/vapi_server_sdk/types/update_conversation_block_dto_messages_item.rb +95 -0
- data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb +4 -16
- data/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_deep_seek_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb +11 -18
- data/lib/vapi_server_sdk/types/update_dtmf_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_dtmf_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb +11 -11
- data/lib/vapi_server_sdk/types/update_end_call_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_end_call_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_function_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_function_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_ghl_tool_dto.rb +159 -0
- data/lib/vapi_server_sdk/types/update_ghl_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_google_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/update_groq_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb +8 -21
- data/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_make_credential_dto.rb +8 -21
- data/lib/vapi_server_sdk/types/update_make_tool_dto.rb +159 -0
- data/lib/vapi_server_sdk/types/update_make_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_org_dto.rb +25 -25
- data/lib/vapi_server_sdk/types/update_output_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_output_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb +11 -18
- data/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb +12 -20
- data/lib/vapi_server_sdk/types/update_smallest_ai_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_text_editor_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_text_editor_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_token_dto.rb +81 -0
- data/lib/vapi_server_sdk/types/update_token_dto_tag.rb +9 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto.rb +168 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto_messages_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto_tool.rb +161 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item.rb +121 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item.rb +121 -0
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +109 -0
- data/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_twilio_phone_number_dto.rb +163 -0
- data/lib/vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb +169 -0
- data/lib/vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_vonage_phone_number_dto.rb +157 -0
- data/lib/vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto.rb +154 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto_messages_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto_steps_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/vapi_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/vonage_phone_number.rb +25 -29
- metadata +88 -21
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_messages_item.rb +0 -96
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_steps_item.rb +0 -96
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_tool.rb +0 -163
- data/lib/vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination.rb +0 -103
- data/lib/vapi_server_sdk/tools/types/update_tool_dto_messages_item.rb +0 -122
- data/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb +0 -65
- data/lib/vapi_server_sdk/types/hipaa_buy_dto.rb +0 -65
- data/lib/vapi_server_sdk/types/payment.rb +0 -167
- data/lib/vapi_server_sdk/types/payment_retry_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/payment_status.rb +0 -11
- data/lib/vapi_server_sdk/types/payments_paginated_response.rb +0 -75
- data/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb +0 -67
- data/lib/vapi_server_sdk/types/subscription_monthly_charge.rb +0 -65
@@ -5,8 +5,6 @@ require "json"
|
|
5
5
|
|
6
6
|
module Vapi
|
7
7
|
class UpdateTavusCredentialDto
|
8
|
-
# @return [String]
|
9
|
-
attr_reader :provider
|
10
8
|
# @return [String] This is not returned in the API.
|
11
9
|
attr_reader :api_key
|
12
10
|
# @return [String] This is the name of credential. This is just for your reference.
|
@@ -19,17 +17,15 @@ module Vapi
|
|
19
17
|
|
20
18
|
OMIT = Object.new
|
21
19
|
|
22
|
-
# @param provider [String]
|
23
20
|
# @param api_key [String] This is not returned in the API.
|
24
21
|
# @param name [String] This is the name of credential. This is just for your reference.
|
25
22
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
23
|
# @return [Vapi::UpdateTavusCredentialDto]
|
27
|
-
def initialize(
|
28
|
-
@
|
29
|
-
@api_key = api_key
|
24
|
+
def initialize(api_key: OMIT, name: OMIT, additional_properties: nil)
|
25
|
+
@api_key = api_key if api_key != OMIT
|
30
26
|
@name = name if name != OMIT
|
31
27
|
@additional_properties = additional_properties
|
32
|
-
@_field_set = { "
|
28
|
+
@_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v|
|
33
29
|
v == OMIT
|
34
30
|
end
|
35
31
|
end
|
@@ -41,11 +37,9 @@ module Vapi
|
|
41
37
|
def self.from_json(json_object:)
|
42
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
39
|
parsed_json = JSON.parse(json_object)
|
44
|
-
provider = parsed_json["provider"]
|
45
40
|
api_key = parsed_json["apiKey"]
|
46
41
|
name = parsed_json["name"]
|
47
42
|
new(
|
48
|
-
provider: provider,
|
49
43
|
api_key: api_key,
|
50
44
|
name: name,
|
51
45
|
additional_properties: struct
|
@@ -66,8 +60,7 @@ module Vapi
|
|
66
60
|
# @param obj [Object]
|
67
61
|
# @return [Void]
|
68
62
|
def self.validate_raw(obj:)
|
69
|
-
obj.
|
70
|
-
obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
63
|
+
obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
71
64
|
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
72
65
|
end
|
73
66
|
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_text_editor_tool_dto_messages_item"
|
4
|
+
require_relative "open_ai_function"
|
5
|
+
require_relative "server"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class UpdateTextEditorToolDto
|
11
|
+
# @return [Boolean] This determines if the tool is async.
|
12
|
+
# If async, the assistant will move forward without waiting for your server to
|
13
|
+
# respond. This is useful if you just want to trigger something on your server.
|
14
|
+
# If sync, the assistant will wait for your server to respond. This is useful if
|
15
|
+
# want assistant to respond with the result from your server.
|
16
|
+
# Defaults to synchronous (`false`).
|
17
|
+
attr_reader :async
|
18
|
+
# @return [Array<Vapi::UpdateTextEditorToolDtoMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
|
19
|
+
# For some tools, this is auto-filled based on special fields like
|
20
|
+
# `tool.destinations`. For others like the function tool, these can be custom
|
21
|
+
# configured.
|
22
|
+
attr_reader :messages
|
23
|
+
# @return [String] The sub type of tool.
|
24
|
+
attr_reader :sub_type
|
25
|
+
# @return [Vapi::OpenAiFunction] This is the function definition of the tool.
|
26
|
+
# For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
|
27
|
+
# tool-specific fields like `tool.destinations`. But, even in those cases, you can
|
28
|
+
# provide a custom function definition for advanced use cases.
|
29
|
+
# An example of an advanced use case is if you want to customize the message
|
30
|
+
# that's spoken for `endCall` tool. You can specify a function where it returns an
|
31
|
+
# argument "reason". Then, in `messages` array, you can have many
|
32
|
+
# "request-complete" messages. One of these messages will be triggered if the
|
33
|
+
# `messages[].conditions` matches the "reason" argument.
|
34
|
+
attr_reader :function
|
35
|
+
# @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
|
36
|
+
# All requests will be sent with the call object among other things. You can find
|
37
|
+
# more details in the Server URL documentation.
|
38
|
+
# This overrides the serverUrl set on the org and the phoneNumber. Order of
|
39
|
+
# precedence: highest tool.server.url, then assistant.serverUrl, then
|
40
|
+
# phoneNumber.serverUrl, then org.serverUrl.
|
41
|
+
attr_reader :server
|
42
|
+
# @return [String] The name of the tool, fixed to 'str_replace_editor'
|
43
|
+
attr_reader :name
|
44
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
45
|
+
attr_reader :additional_properties
|
46
|
+
# @return [Object]
|
47
|
+
attr_reader :_field_set
|
48
|
+
protected :_field_set
|
49
|
+
|
50
|
+
OMIT = Object.new
|
51
|
+
|
52
|
+
# @param async [Boolean] This determines if the tool is async.
|
53
|
+
# If async, the assistant will move forward without waiting for your server to
|
54
|
+
# respond. This is useful if you just want to trigger something on your server.
|
55
|
+
# If sync, the assistant will wait for your server to respond. This is useful if
|
56
|
+
# want assistant to respond with the result from your server.
|
57
|
+
# Defaults to synchronous (`false`).
|
58
|
+
# @param messages [Array<Vapi::UpdateTextEditorToolDtoMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
|
59
|
+
# For some tools, this is auto-filled based on special fields like
|
60
|
+
# `tool.destinations`. For others like the function tool, these can be custom
|
61
|
+
# configured.
|
62
|
+
# @param sub_type [String] The sub type of tool.
|
63
|
+
# @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
|
64
|
+
# For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
|
65
|
+
# tool-specific fields like `tool.destinations`. But, even in those cases, you can
|
66
|
+
# provide a custom function definition for advanced use cases.
|
67
|
+
# An example of an advanced use case is if you want to customize the message
|
68
|
+
# that's spoken for `endCall` tool. You can specify a function where it returns an
|
69
|
+
# argument "reason". Then, in `messages` array, you can have many
|
70
|
+
# "request-complete" messages. One of these messages will be triggered if the
|
71
|
+
# `messages[].conditions` matches the "reason" argument.
|
72
|
+
# @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
|
73
|
+
# All requests will be sent with the call object among other things. You can find
|
74
|
+
# more details in the Server URL documentation.
|
75
|
+
# This overrides the serverUrl set on the org and the phoneNumber. Order of
|
76
|
+
# precedence: highest tool.server.url, then assistant.serverUrl, then
|
77
|
+
# phoneNumber.serverUrl, then org.serverUrl.
|
78
|
+
# @param name [String] The name of the tool, fixed to 'str_replace_editor'
|
79
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
80
|
+
# @return [Vapi::UpdateTextEditorToolDto]
|
81
|
+
def initialize(async: OMIT, messages: OMIT, sub_type: OMIT, function: OMIT, server: OMIT, name: OMIT,
|
82
|
+
additional_properties: nil)
|
83
|
+
@async = async if async != OMIT
|
84
|
+
@messages = messages if messages != OMIT
|
85
|
+
@sub_type = sub_type if sub_type != OMIT
|
86
|
+
@function = function if function != OMIT
|
87
|
+
@server = server if server != OMIT
|
88
|
+
@name = name if name != OMIT
|
89
|
+
@additional_properties = additional_properties
|
90
|
+
@_field_set = {
|
91
|
+
"async": async,
|
92
|
+
"messages": messages,
|
93
|
+
"subType": sub_type,
|
94
|
+
"function": function,
|
95
|
+
"server": server,
|
96
|
+
"name": name
|
97
|
+
}.reject do |_k, v|
|
98
|
+
v == OMIT
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deserialize a JSON object to an instance of UpdateTextEditorToolDto
|
103
|
+
#
|
104
|
+
# @param json_object [String]
|
105
|
+
# @return [Vapi::UpdateTextEditorToolDto]
|
106
|
+
def self.from_json(json_object:)
|
107
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
108
|
+
parsed_json = JSON.parse(json_object)
|
109
|
+
async = parsed_json["async"]
|
110
|
+
messages = parsed_json["messages"]&.map do |item|
|
111
|
+
item = item.to_json
|
112
|
+
Vapi::UpdateTextEditorToolDtoMessagesItem.from_json(json_object: item)
|
113
|
+
end
|
114
|
+
sub_type = parsed_json["subType"]
|
115
|
+
if parsed_json["function"].nil?
|
116
|
+
function = nil
|
117
|
+
else
|
118
|
+
function = parsed_json["function"].to_json
|
119
|
+
function = Vapi::OpenAiFunction.from_json(json_object: function)
|
120
|
+
end
|
121
|
+
if parsed_json["server"].nil?
|
122
|
+
server = nil
|
123
|
+
else
|
124
|
+
server = parsed_json["server"].to_json
|
125
|
+
server = Vapi::Server.from_json(json_object: server)
|
126
|
+
end
|
127
|
+
name = parsed_json["name"]
|
128
|
+
new(
|
129
|
+
async: async,
|
130
|
+
messages: messages,
|
131
|
+
sub_type: sub_type,
|
132
|
+
function: function,
|
133
|
+
server: server,
|
134
|
+
name: name,
|
135
|
+
additional_properties: struct
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Serialize an instance of UpdateTextEditorToolDto to a JSON object
|
140
|
+
#
|
141
|
+
# @return [String]
|
142
|
+
def to_json(*_args)
|
143
|
+
@_field_set&.to_json
|
144
|
+
end
|
145
|
+
|
146
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
147
|
+
# hash and check each fields type against the current object's property
|
148
|
+
# definitions.
|
149
|
+
#
|
150
|
+
# @param obj [Object]
|
151
|
+
# @return [Void]
|
152
|
+
def self.validate_raw(obj:)
|
153
|
+
obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
|
154
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
155
|
+
obj.sub_type&.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.")
|
156
|
+
obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
|
157
|
+
obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
|
158
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "tool_message_start"
|
5
|
+
require_relative "tool_message_complete"
|
6
|
+
require_relative "tool_message_failed"
|
7
|
+
require_relative "tool_message_delayed"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class UpdateTextEditorToolDtoMessagesItem
|
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::UpdateTextEditorToolDtoMessagesItem]
|
22
|
+
def initialize(member:, discriminant:)
|
23
|
+
@member = member
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of UpdateTextEditorToolDtoMessagesItem
|
28
|
+
#
|
29
|
+
# @param json_object [String]
|
30
|
+
# @return [Vapi::UpdateTextEditorToolDtoMessagesItem]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
member = case struct.type
|
34
|
+
when "request-start"
|
35
|
+
Vapi::ToolMessageStart.from_json(json_object: json_object)
|
36
|
+
when "request-complete"
|
37
|
+
Vapi::ToolMessageComplete.from_json(json_object: json_object)
|
38
|
+
when "request-failed"
|
39
|
+
Vapi::ToolMessageFailed.from_json(json_object: json_object)
|
40
|
+
when "request-response-delayed"
|
41
|
+
Vapi::ToolMessageDelayed.from_json(json_object: json_object)
|
42
|
+
else
|
43
|
+
Vapi::ToolMessageStart.from_json(json_object: json_object)
|
44
|
+
end
|
45
|
+
new(member: member, discriminant: struct.type)
|
46
|
+
end
|
47
|
+
|
48
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
def to_json(*_args)
|
52
|
+
case @discriminant
|
53
|
+
when "request-start"
|
54
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
55
|
+
when "request-complete"
|
56
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
57
|
+
when "request-failed"
|
58
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
59
|
+
when "request-response-delayed"
|
60
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
61
|
+
else
|
62
|
+
{ "type": @discriminant, value: @member }.to_json
|
63
|
+
end
|
64
|
+
@member.to_json
|
65
|
+
end
|
66
|
+
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
68
|
+
# hash and check each fields type against the current object's property
|
69
|
+
# definitions.
|
70
|
+
#
|
71
|
+
# @param obj [Object]
|
72
|
+
# @return [Void]
|
73
|
+
def self.validate_raw(obj:)
|
74
|
+
case obj.type
|
75
|
+
when "request-start"
|
76
|
+
Vapi::ToolMessageStart.validate_raw(obj: obj)
|
77
|
+
when "request-complete"
|
78
|
+
Vapi::ToolMessageComplete.validate_raw(obj: obj)
|
79
|
+
when "request-failed"
|
80
|
+
Vapi::ToolMessageFailed.validate_raw(obj: obj)
|
81
|
+
when "request-response-delayed"
|
82
|
+
Vapi::ToolMessageDelayed.validate_raw(obj: obj)
|
83
|
+
else
|
84
|
+
raise("Passed value matched no type within the union, validation failed.")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
89
|
+
#
|
90
|
+
# @param obj [Object]
|
91
|
+
# @return [Boolean]
|
92
|
+
def is_a?(obj)
|
93
|
+
@member.is_a?(obj)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @param member [Vapi::ToolMessageStart]
|
97
|
+
# @return [Vapi::UpdateTextEditorToolDtoMessagesItem]
|
98
|
+
def self.request_start(member:)
|
99
|
+
new(member: member, discriminant: "request-start")
|
100
|
+
end
|
101
|
+
|
102
|
+
# @param member [Vapi::ToolMessageComplete]
|
103
|
+
# @return [Vapi::UpdateTextEditorToolDtoMessagesItem]
|
104
|
+
def self.request_complete(member:)
|
105
|
+
new(member: member, discriminant: "request-complete")
|
106
|
+
end
|
107
|
+
|
108
|
+
# @param member [Vapi::ToolMessageFailed]
|
109
|
+
# @return [Vapi::UpdateTextEditorToolDtoMessagesItem]
|
110
|
+
def self.request_failed(member:)
|
111
|
+
new(member: member, discriminant: "request-failed")
|
112
|
+
end
|
113
|
+
|
114
|
+
# @param member [Vapi::ToolMessageDelayed]
|
115
|
+
# @return [Vapi::UpdateTextEditorToolDtoMessagesItem]
|
116
|
+
def self.request_response_delayed(member:)
|
117
|
+
new(member: member, discriminant: "request-response-delayed")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -5,8 +5,6 @@ require "json"
|
|
5
5
|
|
6
6
|
module Vapi
|
7
7
|
class UpdateTogetherAiCredentialDto
|
8
|
-
# @return [String]
|
9
|
-
attr_reader :provider
|
10
8
|
# @return [String] This is not returned in the API.
|
11
9
|
attr_reader :api_key
|
12
10
|
# @return [String] This is the name of credential. This is just for your reference.
|
@@ -19,17 +17,15 @@ module Vapi
|
|
19
17
|
|
20
18
|
OMIT = Object.new
|
21
19
|
|
22
|
-
# @param provider [String]
|
23
20
|
# @param api_key [String] This is not returned in the API.
|
24
21
|
# @param name [String] This is the name of credential. This is just for your reference.
|
25
22
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
23
|
# @return [Vapi::UpdateTogetherAiCredentialDto]
|
27
|
-
def initialize(
|
28
|
-
@
|
29
|
-
@api_key = api_key
|
24
|
+
def initialize(api_key: OMIT, name: OMIT, additional_properties: nil)
|
25
|
+
@api_key = api_key if api_key != OMIT
|
30
26
|
@name = name if name != OMIT
|
31
27
|
@additional_properties = additional_properties
|
32
|
-
@_field_set = { "
|
28
|
+
@_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v|
|
33
29
|
v == OMIT
|
34
30
|
end
|
35
31
|
end
|
@@ -41,11 +37,9 @@ module Vapi
|
|
41
37
|
def self.from_json(json_object:)
|
42
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
39
|
parsed_json = JSON.parse(json_object)
|
44
|
-
provider = parsed_json["provider"]
|
45
40
|
api_key = parsed_json["apiKey"]
|
46
41
|
name = parsed_json["name"]
|
47
42
|
new(
|
48
|
-
provider: provider,
|
49
43
|
api_key: api_key,
|
50
44
|
name: name,
|
51
45
|
additional_properties: struct
|
@@ -66,8 +60,7 @@ module Vapi
|
|
66
60
|
# @param obj [Object]
|
67
61
|
# @return [Void]
|
68
62
|
def self.validate_raw(obj:)
|
69
|
-
obj.
|
70
|
-
obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
63
|
+
obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
71
64
|
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
72
65
|
end
|
73
66
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_token_dto_tag"
|
4
|
+
require_relative "token_restrictions"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class UpdateTokenDto
|
10
|
+
# @return [Vapi::UpdateTokenDtoTag] This is the tag for the token. It represents its scope.
|
11
|
+
attr_reader :tag
|
12
|
+
# @return [String] This is the name of the token. This is just for your own reference.
|
13
|
+
attr_reader :name
|
14
|
+
# @return [Vapi::TokenRestrictions] This are the restrictions for the token.
|
15
|
+
attr_reader :restrictions
|
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 tag [Vapi::UpdateTokenDtoTag] This is the tag for the token. It represents its scope.
|
25
|
+
# @param name [String] This is the name of the token. This is just for your own reference.
|
26
|
+
# @param restrictions [Vapi::TokenRestrictions] This are the restrictions for the token.
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [Vapi::UpdateTokenDto]
|
29
|
+
def initialize(tag: OMIT, name: OMIT, restrictions: OMIT, additional_properties: nil)
|
30
|
+
@tag = tag if tag != OMIT
|
31
|
+
@name = name if name != OMIT
|
32
|
+
@restrictions = restrictions if restrictions != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "tag": tag, "name": name, "restrictions": restrictions }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of UpdateTokenDto
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [Vapi::UpdateTokenDto]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
tag = parsed_json["tag"]
|
47
|
+
name = parsed_json["name"]
|
48
|
+
if parsed_json["restrictions"].nil?
|
49
|
+
restrictions = nil
|
50
|
+
else
|
51
|
+
restrictions = parsed_json["restrictions"].to_json
|
52
|
+
restrictions = Vapi::TokenRestrictions.from_json(json_object: restrictions)
|
53
|
+
end
|
54
|
+
new(
|
55
|
+
tag: tag,
|
56
|
+
name: name,
|
57
|
+
restrictions: restrictions,
|
58
|
+
additional_properties: struct
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Serialize an instance of UpdateTokenDto to a JSON object
|
63
|
+
#
|
64
|
+
# @return [String]
|
65
|
+
def to_json(*_args)
|
66
|
+
@_field_set&.to_json
|
67
|
+
end
|
68
|
+
|
69
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
70
|
+
# hash and check each fields type against the current object's property
|
71
|
+
# definitions.
|
72
|
+
#
|
73
|
+
# @param obj [Object]
|
74
|
+
# @return [Void]
|
75
|
+
def self.validate_raw(obj:)
|
76
|
+
obj.tag&.is_a?(Vapi::UpdateTokenDtoTag) != false || raise("Passed value for field obj.tag is not the expected type, validation failed.")
|
77
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
78
|
+
obj.restrictions.nil? || Vapi::TokenRestrictions.validate_raw(obj: obj.restrictions)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_tool_call_block_dto_messages_item"
|
4
|
+
require_relative "json_schema"
|
5
|
+
require_relative "update_tool_call_block_dto_tool"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class UpdateToolCallBlockDto
|
11
|
+
# @return [Array<Vapi::UpdateToolCallBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
12
|
+
# block is running.
|
13
|
+
attr_reader :messages
|
14
|
+
# @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
15
|
+
# run. It's given to the block as `steps[0].input`
|
16
|
+
# These are accessible as variables:
|
17
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
18
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
19
|
+
attr_reader :input_schema
|
20
|
+
# @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
21
|
+
# return to the workflow (`{{stepName.output}}`).
|
22
|
+
# These are accessible as variables:
|
23
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
24
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
25
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
26
|
+
# #2)
|
27
|
+
# Caveats:
|
28
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
29
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
30
|
+
# the step.
|
31
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
32
|
+
# multiple times or if a block is used in multiple steps.
|
33
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
34
|
+
# this liquid variable is just provided for convenience when creating blocks
|
35
|
+
# outside of a workflow with steps.
|
36
|
+
attr_reader :output_schema
|
37
|
+
# @return [Vapi::UpdateToolCallBlockDtoTool] This is the tool that the block will call. To use an existing tool, use
|
38
|
+
# `toolId`.
|
39
|
+
attr_reader :tool
|
40
|
+
# @return [String] This is the name of the block. This is just for your reference.
|
41
|
+
attr_reader :name
|
42
|
+
# @return [String] This is the id of the tool that the block will call. To use a transient tool,
|
43
|
+
# use `tool`.
|
44
|
+
attr_reader :tool_id
|
45
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
46
|
+
attr_reader :additional_properties
|
47
|
+
# @return [Object]
|
48
|
+
attr_reader :_field_set
|
49
|
+
protected :_field_set
|
50
|
+
|
51
|
+
OMIT = Object.new
|
52
|
+
|
53
|
+
# @param messages [Array<Vapi::UpdateToolCallBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
54
|
+
# block is running.
|
55
|
+
# @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
56
|
+
# run. It's given to the block as `steps[0].input`
|
57
|
+
# These are accessible as variables:
|
58
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
59
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
60
|
+
# @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
61
|
+
# return to the workflow (`{{stepName.output}}`).
|
62
|
+
# These are accessible as variables:
|
63
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
64
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
65
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
66
|
+
# #2)
|
67
|
+
# Caveats:
|
68
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
69
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
70
|
+
# the step.
|
71
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
72
|
+
# multiple times or if a block is used in multiple steps.
|
73
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
74
|
+
# this liquid variable is just provided for convenience when creating blocks
|
75
|
+
# outside of a workflow with steps.
|
76
|
+
# @param tool [Vapi::UpdateToolCallBlockDtoTool] This is the tool that the block will call. To use an existing tool, use
|
77
|
+
# `toolId`.
|
78
|
+
# @param name [String] This is the name of the block. This is just for your reference.
|
79
|
+
# @param tool_id [String] This is the id of the tool that the block will call. To use a transient tool,
|
80
|
+
# use `tool`.
|
81
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
82
|
+
# @return [Vapi::UpdateToolCallBlockDto]
|
83
|
+
def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, tool: OMIT, name: OMIT, tool_id: OMIT,
|
84
|
+
additional_properties: nil)
|
85
|
+
@messages = messages if messages != OMIT
|
86
|
+
@input_schema = input_schema if input_schema != OMIT
|
87
|
+
@output_schema = output_schema if output_schema != OMIT
|
88
|
+
@tool = tool if tool != OMIT
|
89
|
+
@name = name if name != OMIT
|
90
|
+
@tool_id = tool_id if tool_id != OMIT
|
91
|
+
@additional_properties = additional_properties
|
92
|
+
@_field_set = {
|
93
|
+
"messages": messages,
|
94
|
+
"inputSchema": input_schema,
|
95
|
+
"outputSchema": output_schema,
|
96
|
+
"tool": tool,
|
97
|
+
"name": name,
|
98
|
+
"toolId": tool_id
|
99
|
+
}.reject do |_k, v|
|
100
|
+
v == OMIT
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Deserialize a JSON object to an instance of UpdateToolCallBlockDto
|
105
|
+
#
|
106
|
+
# @param json_object [String]
|
107
|
+
# @return [Vapi::UpdateToolCallBlockDto]
|
108
|
+
def self.from_json(json_object:)
|
109
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
110
|
+
parsed_json = JSON.parse(json_object)
|
111
|
+
messages = parsed_json["messages"]&.map do |item|
|
112
|
+
item = item.to_json
|
113
|
+
Vapi::UpdateToolCallBlockDtoMessagesItem.from_json(json_object: item)
|
114
|
+
end
|
115
|
+
if parsed_json["inputSchema"].nil?
|
116
|
+
input_schema = nil
|
117
|
+
else
|
118
|
+
input_schema = parsed_json["inputSchema"].to_json
|
119
|
+
input_schema = Vapi::JsonSchema.from_json(json_object: input_schema)
|
120
|
+
end
|
121
|
+
if parsed_json["outputSchema"].nil?
|
122
|
+
output_schema = nil
|
123
|
+
else
|
124
|
+
output_schema = parsed_json["outputSchema"].to_json
|
125
|
+
output_schema = Vapi::JsonSchema.from_json(json_object: output_schema)
|
126
|
+
end
|
127
|
+
if parsed_json["tool"].nil?
|
128
|
+
tool = nil
|
129
|
+
else
|
130
|
+
tool = parsed_json["tool"].to_json
|
131
|
+
tool = Vapi::UpdateToolCallBlockDtoTool.from_json(json_object: tool)
|
132
|
+
end
|
133
|
+
name = parsed_json["name"]
|
134
|
+
tool_id = parsed_json["toolId"]
|
135
|
+
new(
|
136
|
+
messages: messages,
|
137
|
+
input_schema: input_schema,
|
138
|
+
output_schema: output_schema,
|
139
|
+
tool: tool,
|
140
|
+
name: name,
|
141
|
+
tool_id: tool_id,
|
142
|
+
additional_properties: struct
|
143
|
+
)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Serialize an instance of UpdateToolCallBlockDto to a JSON object
|
147
|
+
#
|
148
|
+
# @return [String]
|
149
|
+
def to_json(*_args)
|
150
|
+
@_field_set&.to_json
|
151
|
+
end
|
152
|
+
|
153
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
154
|
+
# hash and check each fields type against the current object's property
|
155
|
+
# definitions.
|
156
|
+
#
|
157
|
+
# @param obj [Object]
|
158
|
+
# @return [Void]
|
159
|
+
def self.validate_raw(obj:)
|
160
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
161
|
+
obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema)
|
162
|
+
obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema)
|
163
|
+
obj.tool.nil? || Vapi::UpdateToolCallBlockDtoTool.validate_raw(obj: obj.tool)
|
164
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
165
|
+
obj.tool_id&.is_a?(String) != false || raise("Passed value for field obj.tool_id is not the expected type, validation failed.")
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|