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
@@ -0,0 +1,185 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_computer_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 UpdateComputerToolDto
|
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::UpdateComputerToolDtoMessagesItem>] 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 'computer'
|
43
|
+
attr_reader :name
|
44
|
+
# @return [Float] The display width in pixels
|
45
|
+
attr_reader :display_width_px
|
46
|
+
# @return [Float] The display height in pixels
|
47
|
+
attr_reader :display_height_px
|
48
|
+
# @return [Float] Optional display number
|
49
|
+
attr_reader :display_number
|
50
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
51
|
+
attr_reader :additional_properties
|
52
|
+
# @return [Object]
|
53
|
+
attr_reader :_field_set
|
54
|
+
protected :_field_set
|
55
|
+
|
56
|
+
OMIT = Object.new
|
57
|
+
|
58
|
+
# @param async [Boolean] This determines if the tool is async.
|
59
|
+
# If async, the assistant will move forward without waiting for your server to
|
60
|
+
# respond. This is useful if you just want to trigger something on your server.
|
61
|
+
# If sync, the assistant will wait for your server to respond. This is useful if
|
62
|
+
# want assistant to respond with the result from your server.
|
63
|
+
# Defaults to synchronous (`false`).
|
64
|
+
# @param messages [Array<Vapi::UpdateComputerToolDtoMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
|
65
|
+
# For some tools, this is auto-filled based on special fields like
|
66
|
+
# `tool.destinations`. For others like the function tool, these can be custom
|
67
|
+
# configured.
|
68
|
+
# @param sub_type [String] The sub type of tool.
|
69
|
+
# @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
|
70
|
+
# For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
|
71
|
+
# tool-specific fields like `tool.destinations`. But, even in those cases, you can
|
72
|
+
# provide a custom function definition for advanced use cases.
|
73
|
+
# An example of an advanced use case is if you want to customize the message
|
74
|
+
# that's spoken for `endCall` tool. You can specify a function where it returns an
|
75
|
+
# argument "reason". Then, in `messages` array, you can have many
|
76
|
+
# "request-complete" messages. One of these messages will be triggered if the
|
77
|
+
# `messages[].conditions` matches the "reason" argument.
|
78
|
+
# @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
|
79
|
+
# All requests will be sent with the call object among other things. You can find
|
80
|
+
# more details in the Server URL documentation.
|
81
|
+
# This overrides the serverUrl set on the org and the phoneNumber. Order of
|
82
|
+
# precedence: highest tool.server.url, then assistant.serverUrl, then
|
83
|
+
# phoneNumber.serverUrl, then org.serverUrl.
|
84
|
+
# @param name [String] The name of the tool, fixed to 'computer'
|
85
|
+
# @param display_width_px [Float] The display width in pixels
|
86
|
+
# @param display_height_px [Float] The display height in pixels
|
87
|
+
# @param display_number [Float] Optional display number
|
88
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
89
|
+
# @return [Vapi::UpdateComputerToolDto]
|
90
|
+
def initialize(async: OMIT, messages: OMIT, sub_type: OMIT, function: OMIT, server: OMIT, name: OMIT,
|
91
|
+
display_width_px: OMIT, display_height_px: OMIT, display_number: OMIT, additional_properties: nil)
|
92
|
+
@async = async if async != OMIT
|
93
|
+
@messages = messages if messages != OMIT
|
94
|
+
@sub_type = sub_type if sub_type != OMIT
|
95
|
+
@function = function if function != OMIT
|
96
|
+
@server = server if server != OMIT
|
97
|
+
@name = name if name != OMIT
|
98
|
+
@display_width_px = display_width_px if display_width_px != OMIT
|
99
|
+
@display_height_px = display_height_px if display_height_px != OMIT
|
100
|
+
@display_number = display_number if display_number != OMIT
|
101
|
+
@additional_properties = additional_properties
|
102
|
+
@_field_set = {
|
103
|
+
"async": async,
|
104
|
+
"messages": messages,
|
105
|
+
"subType": sub_type,
|
106
|
+
"function": function,
|
107
|
+
"server": server,
|
108
|
+
"name": name,
|
109
|
+
"displayWidthPx": display_width_px,
|
110
|
+
"displayHeightPx": display_height_px,
|
111
|
+
"displayNumber": display_number
|
112
|
+
}.reject do |_k, v|
|
113
|
+
v == OMIT
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserialize a JSON object to an instance of UpdateComputerToolDto
|
118
|
+
#
|
119
|
+
# @param json_object [String]
|
120
|
+
# @return [Vapi::UpdateComputerToolDto]
|
121
|
+
def self.from_json(json_object:)
|
122
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
123
|
+
parsed_json = JSON.parse(json_object)
|
124
|
+
async = parsed_json["async"]
|
125
|
+
messages = parsed_json["messages"]&.map do |item|
|
126
|
+
item = item.to_json
|
127
|
+
Vapi::UpdateComputerToolDtoMessagesItem.from_json(json_object: item)
|
128
|
+
end
|
129
|
+
sub_type = parsed_json["subType"]
|
130
|
+
if parsed_json["function"].nil?
|
131
|
+
function = nil
|
132
|
+
else
|
133
|
+
function = parsed_json["function"].to_json
|
134
|
+
function = Vapi::OpenAiFunction.from_json(json_object: function)
|
135
|
+
end
|
136
|
+
if parsed_json["server"].nil?
|
137
|
+
server = nil
|
138
|
+
else
|
139
|
+
server = parsed_json["server"].to_json
|
140
|
+
server = Vapi::Server.from_json(json_object: server)
|
141
|
+
end
|
142
|
+
name = parsed_json["name"]
|
143
|
+
display_width_px = parsed_json["displayWidthPx"]
|
144
|
+
display_height_px = parsed_json["displayHeightPx"]
|
145
|
+
display_number = parsed_json["displayNumber"]
|
146
|
+
new(
|
147
|
+
async: async,
|
148
|
+
messages: messages,
|
149
|
+
sub_type: sub_type,
|
150
|
+
function: function,
|
151
|
+
server: server,
|
152
|
+
name: name,
|
153
|
+
display_width_px: display_width_px,
|
154
|
+
display_height_px: display_height_px,
|
155
|
+
display_number: display_number,
|
156
|
+
additional_properties: struct
|
157
|
+
)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Serialize an instance of UpdateComputerToolDto to a JSON object
|
161
|
+
#
|
162
|
+
# @return [String]
|
163
|
+
def to_json(*_args)
|
164
|
+
@_field_set&.to_json
|
165
|
+
end
|
166
|
+
|
167
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
168
|
+
# hash and check each fields type against the current object's property
|
169
|
+
# definitions.
|
170
|
+
#
|
171
|
+
# @param obj [Object]
|
172
|
+
# @return [Void]
|
173
|
+
def self.validate_raw(obj:)
|
174
|
+
obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
|
175
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
176
|
+
obj.sub_type&.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.")
|
177
|
+
obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
|
178
|
+
obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
|
179
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
180
|
+
obj.display_width_px&.is_a?(Float) != false || raise("Passed value for field obj.display_width_px is not the expected type, validation failed.")
|
181
|
+
obj.display_height_px&.is_a?(Float) != false || raise("Passed value for field obj.display_height_px is not the expected type, validation failed.")
|
182
|
+
obj.display_number&.is_a?(Float) != false || raise("Passed value for field obj.display_number is not the expected type, validation failed.")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
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 UpdateComputerToolDtoMessagesItem
|
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::UpdateComputerToolDtoMessagesItem]
|
22
|
+
def initialize(member:, discriminant:)
|
23
|
+
@member = member
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of UpdateComputerToolDtoMessagesItem
|
28
|
+
#
|
29
|
+
# @param json_object [String]
|
30
|
+
# @return [Vapi::UpdateComputerToolDtoMessagesItem]
|
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::UpdateComputerToolDtoMessagesItem]
|
98
|
+
def self.request_start(member:)
|
99
|
+
new(member: member, discriminant: "request-start")
|
100
|
+
end
|
101
|
+
|
102
|
+
# @param member [Vapi::ToolMessageComplete]
|
103
|
+
# @return [Vapi::UpdateComputerToolDtoMessagesItem]
|
104
|
+
def self.request_complete(member:)
|
105
|
+
new(member: member, discriminant: "request-complete")
|
106
|
+
end
|
107
|
+
|
108
|
+
# @param member [Vapi::ToolMessageFailed]
|
109
|
+
# @return [Vapi::UpdateComputerToolDtoMessagesItem]
|
110
|
+
def self.request_failed(member:)
|
111
|
+
new(member: member, discriminant: "request-failed")
|
112
|
+
end
|
113
|
+
|
114
|
+
# @param member [Vapi::ToolMessageDelayed]
|
115
|
+
# @return [Vapi::UpdateComputerToolDtoMessagesItem]
|
116
|
+
def self.request_response_delayed(member:)
|
117
|
+
new(member: member, discriminant: "request-response-delayed")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_conversation_block_dto_messages_item"
|
4
|
+
require_relative "json_schema"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class UpdateConversationBlockDto
|
10
|
+
# @return [Array<Vapi::UpdateConversationBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
11
|
+
# block is running.
|
12
|
+
attr_reader :messages
|
13
|
+
# @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
14
|
+
# run. It's given to the block as `steps[0].input`
|
15
|
+
# These are accessible as variables:
|
16
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
17
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
18
|
+
attr_reader :input_schema
|
19
|
+
# @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
20
|
+
# return to the workflow (`{{stepName.output}}`).
|
21
|
+
# These are accessible as variables:
|
22
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
23
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
24
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
25
|
+
# #2)
|
26
|
+
# Caveats:
|
27
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
28
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
29
|
+
# the step.
|
30
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
31
|
+
# multiple times or if a block is used in multiple steps.
|
32
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
33
|
+
# this liquid variable is just provided for convenience when creating blocks
|
34
|
+
# outside of a workflow with steps.
|
35
|
+
attr_reader :output_schema
|
36
|
+
# @return [String] This is the name of the block. This is just for your reference.
|
37
|
+
attr_reader :name
|
38
|
+
# @return [String] This is the instruction to the model.
|
39
|
+
# You can reference any variable in the context of the current block execution
|
40
|
+
# (step):
|
41
|
+
# - "{{input.your-property-name}}" for the current step's input
|
42
|
+
# - "{{your-step-name.output.your-property-name}}" for another step's output (in
|
43
|
+
# the same workflow; read caveat #1)
|
44
|
+
# - "{{your-step-name.input.your-property-name}}" for another step's input (in the
|
45
|
+
# same workflow; read caveat #1)
|
46
|
+
# - "{{your-block-name.output.your-property-name}}" for another block's output (in
|
47
|
+
# the same workflow; read caveat #2)
|
48
|
+
# - "{{your-block-name.input.your-property-name}}" for another block's input (in
|
49
|
+
# the same workflow; read caveat #2)
|
50
|
+
# - "{{workflow.input.your-property-name}}" for the current workflow's input
|
51
|
+
# - "{{global.your-property-name}}" for the global context
|
52
|
+
# This can be as simple or as complex as you want it to be.
|
53
|
+
# - "say hello and ask the user about their day!"
|
54
|
+
# - "collect the user's first and last name"
|
55
|
+
# - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}.
|
56
|
+
# ask them about their salary and if they might be interested in buying a house.
|
57
|
+
# we offer {{input.offer}}"
|
58
|
+
# Caveats:
|
59
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
60
|
+
# the graph. {{stepName.output/input.propertyName}} will reference the latest
|
61
|
+
# usage of the step.
|
62
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
63
|
+
# multiple times or if a block is used in multiple steps.
|
64
|
+
# {{blockName.output/input.propertyName}} will reference the latest usage of the
|
65
|
+
# block. this liquid variable is just provided for convenience when creating
|
66
|
+
# blocks outside of a workflow with steps.
|
67
|
+
attr_reader :instruction
|
68
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
69
|
+
attr_reader :additional_properties
|
70
|
+
# @return [Object]
|
71
|
+
attr_reader :_field_set
|
72
|
+
protected :_field_set
|
73
|
+
|
74
|
+
OMIT = Object.new
|
75
|
+
|
76
|
+
# @param messages [Array<Vapi::UpdateConversationBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
77
|
+
# block is running.
|
78
|
+
# @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
79
|
+
# run. It's given to the block as `steps[0].input`
|
80
|
+
# These are accessible as variables:
|
81
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
82
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
83
|
+
# @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
84
|
+
# return to the workflow (`{{stepName.output}}`).
|
85
|
+
# These are accessible as variables:
|
86
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
87
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
88
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
89
|
+
# #2)
|
90
|
+
# Caveats:
|
91
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
92
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
93
|
+
# the step.
|
94
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
95
|
+
# multiple times or if a block is used in multiple steps.
|
96
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
97
|
+
# this liquid variable is just provided for convenience when creating blocks
|
98
|
+
# outside of a workflow with steps.
|
99
|
+
# @param name [String] This is the name of the block. This is just for your reference.
|
100
|
+
# @param instruction [String] This is the instruction to the model.
|
101
|
+
# You can reference any variable in the context of the current block execution
|
102
|
+
# (step):
|
103
|
+
# - "{{input.your-property-name}}" for the current step's input
|
104
|
+
# - "{{your-step-name.output.your-property-name}}" for another step's output (in
|
105
|
+
# the same workflow; read caveat #1)
|
106
|
+
# - "{{your-step-name.input.your-property-name}}" for another step's input (in the
|
107
|
+
# same workflow; read caveat #1)
|
108
|
+
# - "{{your-block-name.output.your-property-name}}" for another block's output (in
|
109
|
+
# the same workflow; read caveat #2)
|
110
|
+
# - "{{your-block-name.input.your-property-name}}" for another block's input (in
|
111
|
+
# the same workflow; read caveat #2)
|
112
|
+
# - "{{workflow.input.your-property-name}}" for the current workflow's input
|
113
|
+
# - "{{global.your-property-name}}" for the global context
|
114
|
+
# This can be as simple or as complex as you want it to be.
|
115
|
+
# - "say hello and ask the user about their day!"
|
116
|
+
# - "collect the user's first and last name"
|
117
|
+
# - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}.
|
118
|
+
# ask them about their salary and if they might be interested in buying a house.
|
119
|
+
# we offer {{input.offer}}"
|
120
|
+
# Caveats:
|
121
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
122
|
+
# the graph. {{stepName.output/input.propertyName}} will reference the latest
|
123
|
+
# usage of the step.
|
124
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
125
|
+
# multiple times or if a block is used in multiple steps.
|
126
|
+
# {{blockName.output/input.propertyName}} will reference the latest usage of the
|
127
|
+
# block. this liquid variable is just provided for convenience when creating
|
128
|
+
# blocks outside of a workflow with steps.
|
129
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
130
|
+
# @return [Vapi::UpdateConversationBlockDto]
|
131
|
+
def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, name: OMIT, instruction: OMIT,
|
132
|
+
additional_properties: nil)
|
133
|
+
@messages = messages if messages != OMIT
|
134
|
+
@input_schema = input_schema if input_schema != OMIT
|
135
|
+
@output_schema = output_schema if output_schema != OMIT
|
136
|
+
@name = name if name != OMIT
|
137
|
+
@instruction = instruction if instruction != OMIT
|
138
|
+
@additional_properties = additional_properties
|
139
|
+
@_field_set = {
|
140
|
+
"messages": messages,
|
141
|
+
"inputSchema": input_schema,
|
142
|
+
"outputSchema": output_schema,
|
143
|
+
"name": name,
|
144
|
+
"instruction": instruction
|
145
|
+
}.reject do |_k, v|
|
146
|
+
v == OMIT
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserialize a JSON object to an instance of UpdateConversationBlockDto
|
151
|
+
#
|
152
|
+
# @param json_object [String]
|
153
|
+
# @return [Vapi::UpdateConversationBlockDto]
|
154
|
+
def self.from_json(json_object:)
|
155
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
156
|
+
parsed_json = JSON.parse(json_object)
|
157
|
+
messages = parsed_json["messages"]&.map do |item|
|
158
|
+
item = item.to_json
|
159
|
+
Vapi::UpdateConversationBlockDtoMessagesItem.from_json(json_object: item)
|
160
|
+
end
|
161
|
+
if parsed_json["inputSchema"].nil?
|
162
|
+
input_schema = nil
|
163
|
+
else
|
164
|
+
input_schema = parsed_json["inputSchema"].to_json
|
165
|
+
input_schema = Vapi::JsonSchema.from_json(json_object: input_schema)
|
166
|
+
end
|
167
|
+
if parsed_json["outputSchema"].nil?
|
168
|
+
output_schema = nil
|
169
|
+
else
|
170
|
+
output_schema = parsed_json["outputSchema"].to_json
|
171
|
+
output_schema = Vapi::JsonSchema.from_json(json_object: output_schema)
|
172
|
+
end
|
173
|
+
name = parsed_json["name"]
|
174
|
+
instruction = parsed_json["instruction"]
|
175
|
+
new(
|
176
|
+
messages: messages,
|
177
|
+
input_schema: input_schema,
|
178
|
+
output_schema: output_schema,
|
179
|
+
name: name,
|
180
|
+
instruction: instruction,
|
181
|
+
additional_properties: struct
|
182
|
+
)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Serialize an instance of UpdateConversationBlockDto to a JSON object
|
186
|
+
#
|
187
|
+
# @return [String]
|
188
|
+
def to_json(*_args)
|
189
|
+
@_field_set&.to_json
|
190
|
+
end
|
191
|
+
|
192
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
193
|
+
# hash and check each fields type against the current object's property
|
194
|
+
# definitions.
|
195
|
+
#
|
196
|
+
# @param obj [Object]
|
197
|
+
# @return [Void]
|
198
|
+
def self.validate_raw(obj:)
|
199
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
200
|
+
obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema)
|
201
|
+
obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema)
|
202
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
203
|
+
obj.instruction&.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.")
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "block_start_message"
|
5
|
+
require_relative "block_complete_message"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
class UpdateConversationBlockDtoMessagesItem
|
9
|
+
# @return [Object]
|
10
|
+
attr_reader :member
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :discriminant
|
13
|
+
|
14
|
+
private_class_method :new
|
15
|
+
alias kind_of? is_a?
|
16
|
+
|
17
|
+
# @param member [Object]
|
18
|
+
# @param discriminant [String]
|
19
|
+
# @return [Vapi::UpdateConversationBlockDtoMessagesItem]
|
20
|
+
def initialize(member:, discriminant:)
|
21
|
+
@member = member
|
22
|
+
@discriminant = discriminant
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of
|
26
|
+
# UpdateConversationBlockDtoMessagesItem
|
27
|
+
#
|
28
|
+
# @param json_object [String]
|
29
|
+
# @return [Vapi::UpdateConversationBlockDtoMessagesItem]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
member = case struct.type
|
33
|
+
when "block-start"
|
34
|
+
Vapi::BlockStartMessage.from_json(json_object: json_object)
|
35
|
+
when "block-complete"
|
36
|
+
Vapi::BlockCompleteMessage.from_json(json_object: json_object)
|
37
|
+
else
|
38
|
+
Vapi::BlockStartMessage.from_json(json_object: json_object)
|
39
|
+
end
|
40
|
+
new(member: member, discriminant: struct.type)
|
41
|
+
end
|
42
|
+
|
43
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
def to_json(*_args)
|
47
|
+
case @discriminant
|
48
|
+
when "block-start"
|
49
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
50
|
+
when "block-complete"
|
51
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
52
|
+
else
|
53
|
+
{ "type": @discriminant, value: @member }.to_json
|
54
|
+
end
|
55
|
+
@member.to_json
|
56
|
+
end
|
57
|
+
|
58
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
59
|
+
# hash and check each fields type against the current object's property
|
60
|
+
# definitions.
|
61
|
+
#
|
62
|
+
# @param obj [Object]
|
63
|
+
# @return [Void]
|
64
|
+
def self.validate_raw(obj:)
|
65
|
+
case obj.type
|
66
|
+
when "block-start"
|
67
|
+
Vapi::BlockStartMessage.validate_raw(obj: obj)
|
68
|
+
when "block-complete"
|
69
|
+
Vapi::BlockCompleteMessage.validate_raw(obj: obj)
|
70
|
+
else
|
71
|
+
raise("Passed value matched no type within the union, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
76
|
+
#
|
77
|
+
# @param obj [Object]
|
78
|
+
# @return [Boolean]
|
79
|
+
def is_a?(obj)
|
80
|
+
@member.is_a?(obj)
|
81
|
+
end
|
82
|
+
|
83
|
+
# @param member [Vapi::BlockStartMessage]
|
84
|
+
# @return [Vapi::UpdateConversationBlockDtoMessagesItem]
|
85
|
+
def self.block_start(member:)
|
86
|
+
new(member: member, discriminant: "block-start")
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param member [Vapi::BlockCompleteMessage]
|
90
|
+
# @return [Vapi::UpdateConversationBlockDtoMessagesItem]
|
91
|
+
def self.block_complete(member:)
|
92
|
+
new(member: member, discriminant: "block-complete")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|