From 70aaca59a61b277add32791e9ae25c3bbe1a30dc Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 26 Dec 2024 15:55:36 +0000 Subject: [PATCH] Release 0.2.0 --- lib/requests.rb | 4 +- lib/types_export.rb | 210 ++++++++-- lib/vapi_server_sdk.rb | 7 + lib/vapi_server_sdk/analytics/client.rb | 57 +-- lib/vapi_server_sdk/assistants/client.rb | 117 +++--- ...date_assistant_dto_client_messages_item.rb | 1 + .../types/update_assistant_dto_model.rb | 39 ++ ...date_assistant_dto_server_messages_item.rb | 1 + .../types/update_assistant_dto_transcriber.rb | 28 +- .../types/update_assistant_dto_voice.rb | 26 ++ lib/vapi_server_sdk/calls/client.rb | 86 ++-- lib/vapi_server_sdk/knowledge_bases/client.rb | 394 ++++++++++++++++++ .../types/knowledge_bases_create_request.rb | 96 +++++ .../types/knowledge_bases_create_response.rb | 96 +++++ .../types/knowledge_bases_delete_response.rb | 96 +++++ .../types/knowledge_bases_get_response.rb | 96 +++++ .../knowledge_bases_list_response_item.rb | 96 +++++ .../types/knowledge_bases_update_response.rb | 96 +++++ lib/vapi_server_sdk/logs/client.rb | 16 +- lib/vapi_server_sdk/squads/client.rb | 88 ++-- lib/vapi_server_sdk/tools/client.rb | 4 + .../tools/types/tools_create_request.rb | 39 ++ .../tools/types/tools_create_response.rb | 39 ++ .../tools/types/tools_delete_response.rb | 39 ++ .../tools/types/tools_get_response.rb | 39 ++ .../tools/types/tools_list_response_item.rb | 39 ++ .../tools/types/tools_update_response.rb | 39 ++ .../types/analytics_query_dto.rb | 59 +++ .../types/anthropic_credential.rb | 16 +- lib/vapi_server_sdk/types/anthropic_model.rb | 34 +- .../types/anthropic_model_model.rb | 2 + .../types/anyscale_credential.rb | 16 +- lib/vapi_server_sdk/types/anyscale_model.rb | 34 +- .../types/assembly_ai_credential.rb | 111 +++++ .../types/assembly_ai_transcriber.rb | 97 +++++ lib/vapi_server_sdk/types/assistant.rb | 106 ++--- .../types/assistant_client_messages_item.rb | 1 + .../assistant_custom_endpointing_rule.rb | 100 +++++ lib/vapi_server_sdk/types/assistant_model.rb | 39 ++ .../types/assistant_overrides.rb | 122 +++--- ...ssistant_overrides_client_messages_item.rb | 1 + .../types/assistant_overrides_model.rb | 39 ++ ...ssistant_overrides_server_messages_item.rb | 1 + .../types/assistant_overrides_transcriber.rb | 28 +- .../types/assistant_overrides_voice.rb | 26 ++ .../types/assistant_server_messages_item.rb | 1 + .../types/assistant_transcriber.rb | 28 +- lib/vapi_server_sdk/types/assistant_voice.rb | 26 ++ lib/vapi_server_sdk/types/auto_reload_plan.rb | 65 +++ .../types/auto_reload_plan_dto.rb | 65 +++ lib/vapi_server_sdk/types/azure_credential.rb | 129 ++++++ .../types/azure_credential_region.rb | 23 + .../types/azure_open_ai_credential.rb | 14 +- .../azure_open_ai_credential_models_item.rb | 1 + .../types/azure_open_ai_credential_region.rb | 1 + lib/vapi_server_sdk/types/azure_voice.rb | 46 +- lib/vapi_server_sdk/types/bash_tool.rb | 194 +++++++++ .../types/bash_tool_messages_item.rb | 120 ++++++ .../types/block_complete_message.rb | 33 +- .../types/block_start_message.rb | 33 +- .../types/both_custom_endpointing_rule.rb | 126 ++++++ .../types/byo_sip_trunk_credential.rb | 38 +- lib/vapi_server_sdk/types/call.rb | 16 +- .../types/call_ended_reason.rb | 73 ++-- .../types/call_log_privileged.rb | 88 ++++ .../types/call_log_privileged_level.rb | 12 + .../types/call_logs_paginated_response.rb | 75 ++++ .../types/cartesia_credential.rb | 16 +- lib/vapi_server_sdk/types/cartesia_voice.rb | 46 +- .../types/cartesia_voice_language.rb | 10 +- .../client_inbound_message_add_message.rb | 28 +- .../types/client_inbound_message_message.rb | 13 + .../types/client_inbound_message_transfer.rb | 63 +++ ...nt_inbound_message_transfer_destination.rb | 96 +++++ ...lient_message_language_change_detected.rb} | 10 +- .../types/client_message_message.rb | 31 +- ...ool_calls_tool_with_tool_call_list_item.rb | 154 +++---- .../types/client_message_transfer_update.rb | 116 ++++++ ...ent_message_transfer_update_destination.rb | 122 ++++++ lib/vapi_server_sdk/types/computer_tool.rb | 218 ++++++++++ .../types/computer_tool_messages_item.rb | 120 ++++++ lib/vapi_server_sdk/types/condition.rb | 18 +- .../types/create_anthropic_credential_dto.rb | 13 +- .../types/create_anyscale_credential_dto.rb | 13 +- .../create_assembly_ai_credential_dto.rb | 74 ++++ .../types/create_assistant_dto.rb | 108 ++--- ...eate_assistant_dto_client_messages_item.rb | 1 + .../types/create_assistant_dto_model.rb | 39 ++ ...eate_assistant_dto_server_messages_item.rb | 1 + .../types/create_assistant_dto_transcriber.rb | 28 +- .../types/create_assistant_dto_voice.rb | 26 ++ .../types/create_azure_credential_dto.rb | 95 +++++ .../create_azure_credential_dto_region.rb | 23 + .../create_azure_open_ai_credential_dto.rb | 16 +- ...zure_open_ai_credential_dto_models_item.rb | 1 + ...ate_azure_open_ai_credential_dto_region.rb | 1 + .../types/create_bash_tool_dto.rb | 161 +++++++ .../create_bash_tool_dto_messages_item.rb | 120 ++++++ .../create_byo_sip_trunk_credential_dto.rb | 42 +- .../types/create_cartesia_credential_dto.rb | 13 +- .../types/create_computer_tool_dto.rb | 185 ++++++++ .../create_computer_tool_dto_messages_item.rb | 120 ++++++ .../types/create_custom_knowledge_base_dto.rb | 137 ++++++ .../types/create_custom_llm_credential_dto.rb | 33 +- .../types/create_deep_infra_credential_dto.rb | 13 +- .../types/create_deepgram_credential_dto.rb | 11 +- .../create_eleven_labs_credential_dto.rb | 13 +- .../types/create_gcp_credential_dto.rb | 20 +- .../types/create_gladia_credential_dto.rb | 13 +- .../create_go_high_level_credential_dto.rb | 13 +- .../types/create_google_credential_dto.rb | 76 ++++ .../types/create_groq_credential_dto.rb | 13 +- .../create_inflection_ai_credential_dto.rb | 76 ++++ .../types/create_langfuse_credential_dto.rb | 96 +++++ .../types/create_lmnt_credential_dto.rb | 13 +- .../types/create_make_credential_dto.rb | 19 +- .../types/create_open_ai_credential_dto.rb | 13 +- .../create_open_router_credential_dto.rb | 13 +- lib/vapi_server_sdk/types/create_org_dto.rb | 23 +- .../types/create_org_dto_channel.rb | 10 + .../create_perplexity_ai_credential_dto.rb | 13 +- .../types/create_play_ht_credential_dto.rb | 13 +- .../types/create_rime_ai_credential_dto.rb | 13 +- .../types/create_runpod_credential_dto.rb | 13 +- .../types/create_s_3_credential_dto.rb | 16 +- ...base.rb => create_tavus_credential_dto.rb} | 42 +- .../types/create_text_editor_tool_dto.rb | 161 +++++++ ...eate_text_editor_tool_dto_messages_item.rb | 120 ++++++ .../create_together_ai_credential_dto.rb | 13 +- .../types/create_trieve_knowledge_base_dto.rb | 109 +++++ .../types/create_twilio_credential_dto.rb | 18 +- .../types/create_vapi_phone_number_dto.rb | 22 +- .../types/create_vonage_credential_dto.rb | 18 +- .../types/create_webhook_credential_dto.rb | 84 ++++ .../types/create_x_ai_credential_dto.rb | 76 ++++ lib/vapi_server_sdk/types/credits_buy_dto.rb | 55 +++ .../types/custom_knowledge_base.rb | 154 +++++++ .../types/custom_llm_credential.rb | 49 ++- lib/vapi_server_sdk/types/custom_llm_model.rb | 38 +- lib/vapi_server_sdk/types/custom_message.rb | 92 ++++ .../types/custom_transcriber.rb | 125 ++++++ lib/vapi_server_sdk/types/custom_voice.rb | 132 ++++++ .../types/customer_custom_endpointing_rule.rb | 100 +++++ .../types/deep_infra_credential.rb | 16 +- lib/vapi_server_sdk/types/deep_infra_model.rb | 34 +- .../types/deepgram_credential.rb | 10 +- .../types/deepgram_transcriber.rb | 80 +++- lib/vapi_server_sdk/types/deepgram_voice.rb | 34 +- .../types/eleven_labs_credential.rb | 16 +- .../types/eleven_labs_voice.rb | 52 +-- .../types/fallback_azure_voice.rb | 100 +++++ .../types/fallback_azure_voice_id.rb | 53 +++ .../types/fallback_azure_voice_voice_id.rb | 9 + .../types/fallback_cartesia_voice.rb | 100 +++++ .../types/fallback_cartesia_voice_language.rb | 23 + .../types/fallback_cartesia_voice_model.rb | 10 + .../types/fallback_custom_voice.rb | 117 ++++++ .../types/fallback_deepgram_voice.rb | 81 ++++ .../types/fallback_deepgram_voice_id.rb | 53 +++ .../types/fallback_deepgram_voice_id_enum.rb | 18 + .../types/fallback_eleven_labs_voice.rb | 164 ++++++++ .../types/fallback_eleven_labs_voice_id.rb | 54 +++ .../fallback_eleven_labs_voice_id_enum.rb | 21 + .../types/fallback_eleven_labs_voice_model.rb | 12 + .../types/fallback_lmnt_voice.rb | 88 ++++ .../types/fallback_lmnt_voice_id.rb | 53 +++ .../types/fallback_lmnt_voice_id_enum.rb | 8 + .../types/fallback_neets_voice.rb | 81 ++++ .../types/fallback_neets_voice_id.rb | 53 +++ .../types/fallback_neets_voice_id_enum.rb | 7 + .../types/fallback_open_ai_voice.rb | 87 ++++ .../types/fallback_open_ai_voice_id.rb | 20 + lib/vapi_server_sdk/types/fallback_plan.rb | 61 +++ .../types/fallback_plan_voices_item.rb | 211 ++++++++++ .../types/fallback_play_ht_voice.rb | 172 ++++++++ .../types/fallback_play_ht_voice_emotion.rb | 19 + .../types/fallback_play_ht_voice_id.rb | 53 +++ .../types/fallback_play_ht_voice_id_enum.rb | 16 + .../types/fallback_play_ht_voice_language.rb | 44 ++ .../types/fallback_play_ht_voice_model.rb | 10 + .../types/fallback_rime_ai_voice.rb | 96 +++++ .../types/fallback_rime_ai_voice_id.rb | 53 +++ .../types/fallback_rime_ai_voice_id_enum.rb | 87 ++++ .../types/fallback_rime_ai_voice_model.rb | 9 + .../types/fallback_tavus_voice.rb | 147 +++++++ .../types/fallback_tavus_voice_voice_id.rb | 53 +++ lib/vapi_server_sdk/types/format_plan.rb | 2 - .../types/function_tool_with_tool_call.rb | 11 +- lib/vapi_server_sdk/types/gcp_credential.rb | 4 +- .../types/ghl_tool_with_tool_call.rb | 10 +- .../types/gladia_credential.rb | 16 +- .../types/go_high_level_credential.rb | 16 +- .../types/google_credential.rb | 113 +++++ lib/vapi_server_sdk/types/google_model.rb | 178 ++++++++ .../types/google_model_model.rb | 12 + .../types/google_model_tools_item.rb | 159 +++++++ lib/vapi_server_sdk/types/groq_credential.rb | 16 +- lib/vapi_server_sdk/types/groq_model.rb | 34 +- lib/vapi_server_sdk/types/hipaa_buy_dto.rb | 65 +++ .../types/inflection_ai_credential.rb | 113 +++++ .../types/inflection_ai_model.rb | 177 ++++++++ .../types/inflection_ai_model_tools_item.rb | 159 +++++++ lib/vapi_server_sdk/types/invite_user_dto.rb | 18 +- .../types/knowledge_base_response_document.rb | 74 ++++ .../types/langfuse_credential.rb | 130 ++++++ lib/vapi_server_sdk/types/lmnt_credential.rb | 16 +- lib/vapi_server_sdk/types/lmnt_voice.rb | 32 +- lib/vapi_server_sdk/types/log.rb | 16 +- lib/vapi_server_sdk/types/log_resource.rb | 8 + lib/vapi_server_sdk/types/make_credential.rb | 16 +- .../types/make_tool_with_tool_call.rb | 10 +- lib/vapi_server_sdk/types/neets_voice.rb | 34 +- .../types/o_auth_2_authentication_plan.rb | 79 ++++ .../types/oauth_2_authentication_session.rb | 68 +++ .../types/open_ai_credential.rb | 16 +- lib/vapi_server_sdk/types/open_ai_function.rb | 34 +- lib/vapi_server_sdk/types/open_ai_model.rb | 38 +- .../open_ai_model_fallback_models_item.rb | 2 + .../types/open_ai_model_model.rb | 2 + lib/vapi_server_sdk/types/open_ai_voice.rb | 36 +- lib/vapi_server_sdk/types/open_ai_voice_id.rb | 7 + .../types/open_router_credential.rb | 16 +- .../types/open_router_model.rb | 34 +- lib/vapi_server_sdk/types/org.rb | 37 +- lib/vapi_server_sdk/types/org_channel.rb | 10 + .../types/org_with_org_user.rb | 262 ++++++++++++ .../types/org_with_org_user_channel.rb | 10 + .../types/org_with_org_user_role.rb | 9 + lib/vapi_server_sdk/types/payment.rb | 167 ++++++++ .../types/payment_retry_dto.rb | 55 +++ lib/vapi_server_sdk/types/payment_status.rb | 11 + .../types/payments_paginated_response.rb | 75 ++++ .../types/perplexity_ai_credential.rb | 16 +- .../types/perplexity_ai_model.rb | 34 +- .../types/phone_number_paginated_response.rb | 75 ++++ ..._number_paginated_response_results_item.rb | 121 ++++++ .../types/play_ht_credential.rb | 15 +- lib/vapi_server_sdk/types/play_ht_voice.rb | 52 ++- .../types/play_ht_voice_language.rb | 44 ++ .../types/play_ht_voice_model.rb | 10 + lib/vapi_server_sdk/types/regex_option.rb | 4 +- .../types/regex_option_type.rb | 2 +- .../types/regex_replacement.rb | 18 +- .../types/rime_ai_credential.rb | 16 +- lib/vapi_server_sdk/types/rime_ai_voice.rb | 32 +- .../types/runpod_credential.rb | 16 +- lib/vapi_server_sdk/types/s_3_credential.rb | 16 +- lib/vapi_server_sdk/types/server.rb | 18 +- ...message_end_of_call_report_ended_reason.rb | 73 ++-- .../server_message_knowledge_base_request.rb | 195 +++++++++ ...ge_knowledge_base_request_messages_item.rb | 97 +++++ ...ge_knowledge_base_request_phone_number.rb} | 16 +- ...erver_message_language_change_detected.rb} | 20 +- ...e_language_change_detected_phone_number.rb | 125 ++++++ .../types/server_message_message.rb | 31 +- ...message_response_knowledge_base_request.rb | 81 ++++ ...erver_message_response_message_response.rb | 14 + ...rver_message_status_update_ended_reason.rb | 73 ++-- ...ool_calls_tool_with_tool_call_list_item.rb | 154 +++---- .../types/server_message_transfer_update.rb | 20 +- .../types/sip_authentication.rb | 80 ++++ .../types/start_speaking_plan.rb | 64 ++- ...king_plan_custom_endpointing_rules_item.rb | 108 +++++ .../types/structured_data_plan.rb | 38 +- lib/vapi_server_sdk/types/subscription.rb | 336 +++++++++++++++ .../subscription_concurrency_line_buy_dto.rb | 55 +++ ...ubscription_concurrency_line_remove_dto.rb | 55 +++ .../types/subscription_coupon_add_dto.rb | 67 +++ .../types/subscription_monthly_charge.rb | 65 +++ .../types/subscription_status.rb | 10 + .../types/subscription_type.rb | 10 + .../types/success_evaluation_plan.rb | 54 ++- lib/vapi_server_sdk/types/summary_plan.rb | 34 +- .../sync_voice_library_dto_providers_item.rb | 1 + .../types/tavus_conversation_properties.rb | 173 ++++++++ lib/vapi_server_sdk/types/tavus_credential.rb | 111 +++++ lib/vapi_server_sdk/types/tavus_voice.rb | 163 ++++++++ .../types/tavus_voice_voice_id.rb | 53 +++ lib/vapi_server_sdk/types/text_content.rb | 73 ++++ .../types/text_content_language.rb | 191 +++++++++ lib/vapi_server_sdk/types/text_editor_tool.rb | 194 +++++++++ .../types/text_editor_tool_messages_item.rb | 120 ++++++ .../types/together_ai_credential.rb | 16 +- .../types/together_ai_model.rb | 34 +- .../types/tool_message_complete.rb | 32 +- .../types/tool_message_delayed.rb | 33 +- .../types/tool_message_failed.rb | 33 +- .../types/tool_message_start.rb | 33 +- .../types/transfer_destination_assistant.rb | 112 +++-- .../transfer_destination_assistant_message.rb | 65 +++ .../types/transfer_destination_number.rb | 80 ++-- .../transfer_destination_number_message.rb | 65 +++ .../types/transfer_destination_sip.rb | 75 +++- .../types/transfer_destination_sip_message.rb | 65 +++ .../types/transfer_destination_step.rb | 42 +- .../transfer_destination_step_message.rb | 65 +++ lib/vapi_server_sdk/types/transfer_plan.rb | 141 +++++++ .../types/transfer_plan_message.rb | 58 +++ .../types/transfer_plan_mode.rb | 32 ++ lib/vapi_server_sdk/types/transport.rb | 70 ++++ lib/vapi_server_sdk/types/transport_cost.rb | 14 +- .../types/transport_cost_provider.rb | 9 + .../types/transport_provider.rb | 11 + .../types/trieve_knowledge_base.rb | 125 ++++++ ...knowledge_base_vector_store_create_plan.rb | 109 +++++ ...knowledge_base_vector_store_search_plan.rb | 95 +++++ ...se_vector_store_search_plan_search_type.rb | 12 + .../types/twilio_credential.rb | 14 +- .../types/update_anthropic_credential_dto.rb | 13 +- .../types/update_anyscale_credential_dto.rb | 13 +- .../update_assembly_ai_credential_dto.rb | 74 ++++ .../types/update_azure_credential_dto.rb | 95 +++++ .../update_azure_credential_dto_region.rb | 23 + .../update_azure_open_ai_credential_dto.rb | 16 +- ...zure_open_ai_credential_dto_models_item.rb | 1 + ...ate_azure_open_ai_credential_dto_region.rb | 1 + .../update_byo_sip_trunk_credential_dto.rb | 42 +- .../types/update_cartesia_credential_dto.rb | 13 +- .../types/update_custom_llm_credential_dto.rb | 33 +- .../types/update_deep_infra_credential_dto.rb | 13 +- .../types/update_deepgram_credential_dto.rb | 11 +- .../update_eleven_labs_credential_dto.rb | 13 +- .../types/update_gcp_credential_dto.rb | 20 +- .../types/update_gladia_credential_dto.rb | 13 +- .../update_go_high_level_credential_dto.rb | 13 +- .../types/update_google_credential_dto.rb | 76 ++++ .../types/update_groq_credential_dto.rb | 13 +- .../update_inflection_ai_credential_dto.rb | 76 ++++ .../types/update_langfuse_credential_dto.rb | 96 +++++ .../types/update_lmnt_credential_dto.rb | 13 +- .../types/update_make_credential_dto.rb | 19 +- .../types/update_open_ai_credential_dto.rb | 13 +- .../update_open_router_credential_dto.rb | 13 +- lib/vapi_server_sdk/types/update_org_dto.rb | 23 +- .../types/update_org_dto_channel.rb | 10 + .../update_perplexity_ai_credential_dto.rb | 13 +- .../types/update_play_ht_credential_dto.rb | 13 +- .../types/update_rime_ai_credential_dto.rb | 13 +- .../types/update_runpod_credential_dto.rb | 13 +- .../types/update_s_3_credential_dto.rb | 16 +- .../types/update_tavus_credential_dto.rb | 74 ++++ .../update_together_ai_credential_dto.rb | 13 +- .../types/update_twilio_credential_dto.rb | 18 +- .../types/update_vonage_credential_dto.rb | 18 +- .../types/update_x_ai_credential_dto.rb | 76 ++++ lib/vapi_server_sdk/types/vapi_cost.rb | 12 +- .../types/vapi_cost_sub_type.rb | 9 + lib/vapi_server_sdk/types/vapi_model.rb | 40 +- .../types/vapi_phone_number.rb | 22 +- .../types/vonage_credential.rb | 14 +- .../types/webhook_credential.rb | 134 ++++++ lib/vapi_server_sdk/types/x_ai_credential.rb | 113 +++++ lib/vapi_server_sdk/types/xai_model.rb | 177 ++++++++ .../types/xai_model_tools_item.rb | 159 +++++++ vapi_server_sdk.gemspec | 2 +- 355 files changed, 18219 insertions(+), 1413 deletions(-) create mode 100644 lib/vapi_server_sdk/knowledge_bases/client.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item.rb create mode 100644 lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response.rb create mode 100644 lib/vapi_server_sdk/types/analytics_query_dto.rb create mode 100644 lib/vapi_server_sdk/types/assembly_ai_credential.rb create mode 100644 lib/vapi_server_sdk/types/assembly_ai_transcriber.rb create mode 100644 lib/vapi_server_sdk/types/assistant_custom_endpointing_rule.rb create mode 100644 lib/vapi_server_sdk/types/auto_reload_plan.rb create mode 100644 lib/vapi_server_sdk/types/auto_reload_plan_dto.rb create mode 100644 lib/vapi_server_sdk/types/azure_credential.rb create mode 100644 lib/vapi_server_sdk/types/azure_credential_region.rb create mode 100644 lib/vapi_server_sdk/types/bash_tool.rb create mode 100644 lib/vapi_server_sdk/types/bash_tool_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/both_custom_endpointing_rule.rb create mode 100644 lib/vapi_server_sdk/types/call_log_privileged.rb create mode 100644 lib/vapi_server_sdk/types/call_log_privileged_level.rb create mode 100644 lib/vapi_server_sdk/types/call_logs_paginated_response.rb create mode 100644 lib/vapi_server_sdk/types/client_inbound_message_transfer.rb create mode 100644 lib/vapi_server_sdk/types/client_inbound_message_transfer_destination.rb rename lib/vapi_server_sdk/types/{client_message_language_changed.rb => client_message_language_change_detected.rb} (86%) create mode 100644 lib/vapi_server_sdk/types/client_message_transfer_update.rb create mode 100644 lib/vapi_server_sdk/types/client_message_transfer_update_destination.rb create mode 100644 lib/vapi_server_sdk/types/computer_tool.rb create mode 100644 lib/vapi_server_sdk/types/computer_tool_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_azure_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb create mode 100644 lib/vapi_server_sdk/types/create_bash_tool_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_bash_tool_dto_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/create_computer_tool_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_computer_tool_dto_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_google_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_inflection_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_org_dto_channel.rb rename lib/vapi_server_sdk/types/{knowledge_base.rb => create_tavus_credential_dto.rb} (53%) create mode 100644 lib/vapi_server_sdk/types/create_text_editor_tool_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_text_editor_tool_dto_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_webhook_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/credits_buy_dto.rb create mode 100644 lib/vapi_server_sdk/types/custom_knowledge_base.rb create mode 100644 lib/vapi_server_sdk/types/custom_message.rb create mode 100644 lib/vapi_server_sdk/types/custom_transcriber.rb create mode 100644 lib/vapi_server_sdk/types/custom_voice.rb create mode 100644 lib/vapi_server_sdk/types/customer_custom_endpointing_rule.rb create mode 100644 lib/vapi_server_sdk/types/fallback_azure_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_azure_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_azure_voice_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_cartesia_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_cartesia_voice_language.rb create mode 100644 lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb create mode 100644 lib/vapi_server_sdk/types/fallback_custom_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_deepgram_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_deepgram_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_deepgram_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb create mode 100644 lib/vapi_server_sdk/types/fallback_lmnt_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_lmnt_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_lmnt_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_neets_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_neets_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_neets_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_open_ai_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_plan.rb create mode 100644 lib/vapi_server_sdk/types/fallback_plan_voices_item.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice_emotion.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice_language.rb create mode 100644 lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb create mode 100644 lib/vapi_server_sdk/types/fallback_rime_ai_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_rime_ai_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb create mode 100644 lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb create mode 100644 lib/vapi_server_sdk/types/fallback_tavus_voice.rb create mode 100644 lib/vapi_server_sdk/types/fallback_tavus_voice_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/google_credential.rb create mode 100644 lib/vapi_server_sdk/types/google_model.rb create mode 100644 lib/vapi_server_sdk/types/google_model_model.rb create mode 100644 lib/vapi_server_sdk/types/google_model_tools_item.rb create mode 100644 lib/vapi_server_sdk/types/hipaa_buy_dto.rb create mode 100644 lib/vapi_server_sdk/types/inflection_ai_credential.rb create mode 100644 lib/vapi_server_sdk/types/inflection_ai_model.rb create mode 100644 lib/vapi_server_sdk/types/inflection_ai_model_tools_item.rb create mode 100644 lib/vapi_server_sdk/types/knowledge_base_response_document.rb create mode 100644 lib/vapi_server_sdk/types/langfuse_credential.rb create mode 100644 lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb create mode 100644 lib/vapi_server_sdk/types/oauth_2_authentication_session.rb create mode 100644 lib/vapi_server_sdk/types/org_channel.rb create mode 100644 lib/vapi_server_sdk/types/org_with_org_user.rb create mode 100644 lib/vapi_server_sdk/types/org_with_org_user_channel.rb create mode 100644 lib/vapi_server_sdk/types/org_with_org_user_role.rb create mode 100644 lib/vapi_server_sdk/types/payment.rb create mode 100644 lib/vapi_server_sdk/types/payment_retry_dto.rb create mode 100644 lib/vapi_server_sdk/types/payment_status.rb create mode 100644 lib/vapi_server_sdk/types/payments_paginated_response.rb create mode 100644 lib/vapi_server_sdk/types/phone_number_paginated_response.rb create mode 100644 lib/vapi_server_sdk/types/phone_number_paginated_response_results_item.rb create mode 100644 lib/vapi_server_sdk/types/play_ht_voice_language.rb create mode 100644 lib/vapi_server_sdk/types/play_ht_voice_model.rb create mode 100644 lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb create mode 100644 lib/vapi_server_sdk/types/server_message_knowledge_base_request_messages_item.rb rename lib/vapi_server_sdk/types/{server_message_language_changed_phone_number.rb => server_message_knowledge_base_request_phone_number.rb} (88%) rename lib/vapi_server_sdk/types/{server_message_language_changed.rb => server_message_language_change_detected.rb} (89%) create mode 100644 lib/vapi_server_sdk/types/server_message_language_change_detected_phone_number.rb create mode 100644 lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb create mode 100644 lib/vapi_server_sdk/types/sip_authentication.rb create mode 100644 lib/vapi_server_sdk/types/start_speaking_plan_custom_endpointing_rules_item.rb create mode 100644 lib/vapi_server_sdk/types/subscription.rb create mode 100644 lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb create mode 100644 lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb create mode 100644 lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb create mode 100644 lib/vapi_server_sdk/types/subscription_monthly_charge.rb create mode 100644 lib/vapi_server_sdk/types/subscription_status.rb create mode 100644 lib/vapi_server_sdk/types/subscription_type.rb create mode 100644 lib/vapi_server_sdk/types/tavus_conversation_properties.rb create mode 100644 lib/vapi_server_sdk/types/tavus_credential.rb create mode 100644 lib/vapi_server_sdk/types/tavus_voice.rb create mode 100644 lib/vapi_server_sdk/types/tavus_voice_voice_id.rb create mode 100644 lib/vapi_server_sdk/types/text_content.rb create mode 100644 lib/vapi_server_sdk/types/text_content_language.rb create mode 100644 lib/vapi_server_sdk/types/text_editor_tool.rb create mode 100644 lib/vapi_server_sdk/types/text_editor_tool_messages_item.rb create mode 100644 lib/vapi_server_sdk/types/transfer_destination_assistant_message.rb create mode 100644 lib/vapi_server_sdk/types/transfer_destination_number_message.rb create mode 100644 lib/vapi_server_sdk/types/transfer_destination_sip_message.rb create mode 100644 lib/vapi_server_sdk/types/transfer_destination_step_message.rb create mode 100644 lib/vapi_server_sdk/types/transfer_plan.rb create mode 100644 lib/vapi_server_sdk/types/transfer_plan_message.rb create mode 100644 lib/vapi_server_sdk/types/transfer_plan_mode.rb create mode 100644 lib/vapi_server_sdk/types/transport.rb create mode 100644 lib/vapi_server_sdk/types/transport_cost_provider.rb create mode 100644 lib/vapi_server_sdk/types/transport_provider.rb create mode 100644 lib/vapi_server_sdk/types/trieve_knowledge_base.rb create mode 100644 lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_create_plan.rb create mode 100644 lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan.rb create mode 100644 lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type.rb create mode 100644 lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_azure_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb create mode 100644 lib/vapi_server_sdk/types/update_google_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_org_dto_channel.rb create mode 100644 lib/vapi_server_sdk/types/update_tavus_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb create mode 100644 lib/vapi_server_sdk/types/vapi_cost_sub_type.rb create mode 100644 lib/vapi_server_sdk/types/webhook_credential.rb create mode 100644 lib/vapi_server_sdk/types/x_ai_credential.rb create mode 100644 lib/vapi_server_sdk/types/xai_model.rb create mode 100644 lib/vapi_server_sdk/types/xai_model_tools_item.rb diff --git a/lib/requests.rb b/lib/requests.rb index c621427..9e40b1b 100644 --- a/lib/requests.rb +++ b/lib/requests.rb @@ -45,7 +45,7 @@ def get_url(request_options: nil) # @return [Hash{String => String}] def get_headers - headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.1.0" } + headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" } headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil? headers end @@ -90,7 +90,7 @@ def get_url(request_options: nil) # @return [Hash{String => String}] def get_headers - headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.1.0" } + headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" } headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil? headers end diff --git a/lib/types_export.rb b/lib/types_export.rb index 3f40e48..1d46f6f 100644 --- a/lib/types_export.rb +++ b/lib/types_export.rb @@ -14,6 +14,12 @@ require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_delete_response" require_relative "vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_update_response" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response" require_relative "vapi_server_sdk/blocks/types/blocks_list_response_item" require_relative "vapi_server_sdk/blocks/types/blocks_create_request" require_relative "vapi_server_sdk/blocks/types/blocks_create_response" @@ -32,6 +38,9 @@ require_relative "vapi_server_sdk/tools/types/tools_update_response" require_relative "vapi_server_sdk/logs/types/logs_get_request_type" require_relative "vapi_server_sdk/logs/types/logs_get_request_sort_order" +require_relative "vapi_server_sdk/types/assembly_ai_transcriber" +require_relative "vapi_server_sdk/types/server" +require_relative "vapi_server_sdk/types/custom_transcriber" require_relative "vapi_server_sdk/types/deepgram_transcriber" require_relative "vapi_server_sdk/types/talkscriber_transcriber_language" require_relative "vapi_server_sdk/types/talkscriber_transcriber" @@ -39,6 +48,8 @@ require_relative "vapi_server_sdk/types/gladia_transcriber_language_behaviour" require_relative "vapi_server_sdk/types/gladia_transcriber_language" require_relative "vapi_server_sdk/types/gladia_transcriber" +require_relative "vapi_server_sdk/types/text_content_language" +require_relative "vapi_server_sdk/types/text_content" require_relative "vapi_server_sdk/types/condition_operator" require_relative "vapi_server_sdk/types/condition" require_relative "vapi_server_sdk/types/tool_message_start" @@ -50,7 +61,6 @@ require_relative "vapi_server_sdk/types/json_schema" require_relative "vapi_server_sdk/types/open_ai_function_parameters" require_relative "vapi_server_sdk/types/open_ai_function" -require_relative "vapi_server_sdk/types/server" require_relative "vapi_server_sdk/types/create_dtmf_tool_dto_messages_item" require_relative "vapi_server_sdk/types/create_dtmf_tool_dto" require_relative "vapi_server_sdk/types/create_end_call_tool_dto_messages_item" @@ -65,16 +75,25 @@ require_relative "vapi_server_sdk/types/make_tool_metadata" require_relative "vapi_server_sdk/types/create_make_tool_dto_messages_item" require_relative "vapi_server_sdk/types/create_make_tool_dto" +require_relative "vapi_server_sdk/types/custom_message" +require_relative "vapi_server_sdk/types/transfer_destination_assistant_message" require_relative "vapi_server_sdk/types/transfer_destination_assistant" +require_relative "vapi_server_sdk/types/transfer_destination_step_message" require_relative "vapi_server_sdk/types/transfer_destination_step" +require_relative "vapi_server_sdk/types/summary_plan" +require_relative "vapi_server_sdk/types/transfer_plan_mode" +require_relative "vapi_server_sdk/types/transfer_plan_message" +require_relative "vapi_server_sdk/types/transfer_plan" +require_relative "vapi_server_sdk/types/transfer_destination_number_message" require_relative "vapi_server_sdk/types/transfer_destination_number" +require_relative "vapi_server_sdk/types/transfer_destination_sip_message" require_relative "vapi_server_sdk/types/transfer_destination_sip" require_relative "vapi_server_sdk/types/create_transfer_call_tool_dto_messages_item" require_relative "vapi_server_sdk/types/create_transfer_call_tool_dto_destinations_item" require_relative "vapi_server_sdk/types/create_transfer_call_tool_dto" +require_relative "vapi_server_sdk/types/create_custom_knowledge_base_dto" require_relative "vapi_server_sdk/types/open_ai_message_role" require_relative "vapi_server_sdk/types/open_ai_message" -require_relative "vapi_server_sdk/types/knowledge_base" require_relative "vapi_server_sdk/types/anyscale_model_tools_item" require_relative "vapi_server_sdk/types/anyscale_model" require_relative "vapi_server_sdk/types/anthropic_model_tools_item" @@ -85,9 +104,14 @@ require_relative "vapi_server_sdk/types/custom_llm_model" require_relative "vapi_server_sdk/types/deep_infra_model_tools_item" require_relative "vapi_server_sdk/types/deep_infra_model" +require_relative "vapi_server_sdk/types/google_model_tools_item" +require_relative "vapi_server_sdk/types/google_model_model" +require_relative "vapi_server_sdk/types/google_model" require_relative "vapi_server_sdk/types/groq_model_tools_item" require_relative "vapi_server_sdk/types/groq_model_model" require_relative "vapi_server_sdk/types/groq_model" +require_relative "vapi_server_sdk/types/inflection_ai_model_tools_item" +require_relative "vapi_server_sdk/types/inflection_ai_model" require_relative "vapi_server_sdk/types/open_ai_model_tools_item" require_relative "vapi_server_sdk/types/open_ai_model_model" require_relative "vapi_server_sdk/types/open_ai_model_fallback_models_item" @@ -101,6 +125,8 @@ require_relative "vapi_server_sdk/types/vapi_model_tools_item" require_relative "vapi_server_sdk/types/vapi_model_steps_item" require_relative "vapi_server_sdk/types/vapi_model" +require_relative "vapi_server_sdk/types/xai_model_tools_item" +require_relative "vapi_server_sdk/types/xai_model" require_relative "vapi_server_sdk/types/exact_replacement" require_relative "vapi_server_sdk/types/regex_option_type" require_relative "vapi_server_sdk/types/regex_option" @@ -108,12 +134,15 @@ require_relative "vapi_server_sdk/types/format_plan_replacements_item" require_relative "vapi_server_sdk/types/format_plan" require_relative "vapi_server_sdk/types/chunk_plan" +require_relative "vapi_server_sdk/types/fallback_plan_voices_item" +require_relative "vapi_server_sdk/types/fallback_plan" require_relative "vapi_server_sdk/types/azure_voice_id_enum" require_relative "vapi_server_sdk/types/azure_voice_id" require_relative "vapi_server_sdk/types/azure_voice" require_relative "vapi_server_sdk/types/cartesia_voice_model" require_relative "vapi_server_sdk/types/cartesia_voice_language" require_relative "vapi_server_sdk/types/cartesia_voice" +require_relative "vapi_server_sdk/types/custom_voice" require_relative "vapi_server_sdk/types/deepgram_voice_id_enum" require_relative "vapi_server_sdk/types/deepgram_voice_id" require_relative "vapi_server_sdk/types/deepgram_voice" @@ -132,16 +161,54 @@ require_relative "vapi_server_sdk/types/play_ht_voice_id_enum" require_relative "vapi_server_sdk/types/play_ht_voice_id" require_relative "vapi_server_sdk/types/play_ht_voice_emotion" +require_relative "vapi_server_sdk/types/play_ht_voice_model" +require_relative "vapi_server_sdk/types/play_ht_voice_language" require_relative "vapi_server_sdk/types/play_ht_voice" require_relative "vapi_server_sdk/types/rime_ai_voice_id_enum" require_relative "vapi_server_sdk/types/rime_ai_voice_id" require_relative "vapi_server_sdk/types/rime_ai_voice_model" require_relative "vapi_server_sdk/types/rime_ai_voice" +require_relative "vapi_server_sdk/types/tavus_conversation_properties" +require_relative "vapi_server_sdk/types/tavus_voice_voice_id" +require_relative "vapi_server_sdk/types/tavus_voice" +require_relative "vapi_server_sdk/types/fallback_azure_voice_voice_id" +require_relative "vapi_server_sdk/types/fallback_azure_voice_id" +require_relative "vapi_server_sdk/types/fallback_azure_voice" +require_relative "vapi_server_sdk/types/fallback_cartesia_voice_model" +require_relative "vapi_server_sdk/types/fallback_cartesia_voice_language" +require_relative "vapi_server_sdk/types/fallback_cartesia_voice" +require_relative "vapi_server_sdk/types/fallback_custom_voice" +require_relative "vapi_server_sdk/types/fallback_deepgram_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_deepgram_voice_id" +require_relative "vapi_server_sdk/types/fallback_deepgram_voice" +require_relative "vapi_server_sdk/types/fallback_eleven_labs_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_eleven_labs_voice_id" +require_relative "vapi_server_sdk/types/fallback_eleven_labs_voice_model" +require_relative "vapi_server_sdk/types/fallback_eleven_labs_voice" +require_relative "vapi_server_sdk/types/fallback_lmnt_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_lmnt_voice_id" +require_relative "vapi_server_sdk/types/fallback_lmnt_voice" +require_relative "vapi_server_sdk/types/fallback_neets_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_neets_voice_id" +require_relative "vapi_server_sdk/types/fallback_neets_voice" +require_relative "vapi_server_sdk/types/fallback_open_ai_voice_id" +require_relative "vapi_server_sdk/types/fallback_open_ai_voice" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice_id" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice_emotion" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice_model" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice_language" +require_relative "vapi_server_sdk/types/fallback_play_ht_voice" +require_relative "vapi_server_sdk/types/fallback_rime_ai_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_rime_ai_voice_id" +require_relative "vapi_server_sdk/types/fallback_rime_ai_voice_model" +require_relative "vapi_server_sdk/types/fallback_rime_ai_voice" +require_relative "vapi_server_sdk/types/fallback_tavus_voice_voice_id" +require_relative "vapi_server_sdk/types/fallback_tavus_voice" require_relative "vapi_server_sdk/types/transport_configuration_twilio_recording_channels" require_relative "vapi_server_sdk/types/transport_configuration_twilio" require_relative "vapi_server_sdk/types/twilio_voicemail_detection_voicemail_detection_types_item" require_relative "vapi_server_sdk/types/twilio_voicemail_detection" -require_relative "vapi_server_sdk/types/summary_plan" require_relative "vapi_server_sdk/types/structured_data_plan" require_relative "vapi_server_sdk/types/success_evaluation_plan_rubric" require_relative "vapi_server_sdk/types/success_evaluation_plan" @@ -149,7 +216,11 @@ require_relative "vapi_server_sdk/types/transcript_plan" require_relative "vapi_server_sdk/types/artifact_plan" require_relative "vapi_server_sdk/types/message_plan" +require_relative "vapi_server_sdk/types/assistant_custom_endpointing_rule" +require_relative "vapi_server_sdk/types/customer_custom_endpointing_rule" +require_relative "vapi_server_sdk/types/both_custom_endpointing_rule" require_relative "vapi_server_sdk/types/transcription_endpointing_plan" +require_relative "vapi_server_sdk/types/start_speaking_plan_custom_endpointing_rules_item" require_relative "vapi_server_sdk/types/start_speaking_plan" require_relative "vapi_server_sdk/types/stop_speaking_plan" require_relative "vapi_server_sdk/types/monitor_plan" @@ -185,6 +256,8 @@ require_relative "vapi_server_sdk/types/tool_call_result_message" require_relative "vapi_server_sdk/types/artifact_messages_item" require_relative "vapi_server_sdk/types/artifact" +require_relative "vapi_server_sdk/types/transport_provider" +require_relative "vapi_server_sdk/types/transport" require_relative "vapi_server_sdk/types/call_type" require_relative "vapi_server_sdk/types/call_costs_item" require_relative "vapi_server_sdk/types/call_messages_item" @@ -212,6 +285,7 @@ require_relative "vapi_server_sdk/types/twilio_phone_number" require_relative "vapi_server_sdk/types/vonage_phone_number_fallback_destination" require_relative "vapi_server_sdk/types/vonage_phone_number" +require_relative "vapi_server_sdk/types/sip_authentication" require_relative "vapi_server_sdk/types/vapi_phone_number_fallback_destination" require_relative "vapi_server_sdk/types/vapi_phone_number" require_relative "vapi_server_sdk/types/create_byo_phone_number_dto_fallback_destination" @@ -226,7 +300,30 @@ require_relative "vapi_server_sdk/types/buy_phone_number_dto" require_relative "vapi_server_sdk/types/import_vonage_phone_number_dto_fallback_destination" require_relative "vapi_server_sdk/types/import_vonage_phone_number_dto" +require_relative "vapi_server_sdk/types/phone_number_paginated_response_results_item" +require_relative "vapi_server_sdk/types/phone_number_paginated_response" +require_relative "vapi_server_sdk/types/auto_reload_plan" +require_relative "vapi_server_sdk/types/subscription_type" +require_relative "vapi_server_sdk/types/subscription_status" +require_relative "vapi_server_sdk/types/subscription" +require_relative "vapi_server_sdk/types/payment_status" +require_relative "vapi_server_sdk/types/payment" +require_relative "vapi_server_sdk/types/payments_paginated_response" +require_relative "vapi_server_sdk/types/subscription_monthly_charge" +require_relative "vapi_server_sdk/types/credits_buy_dto" +require_relative "vapi_server_sdk/types/auto_reload_plan_dto" +require_relative "vapi_server_sdk/types/payment_retry_dto" +require_relative "vapi_server_sdk/types/subscription_concurrency_line_buy_dto" +require_relative "vapi_server_sdk/types/subscription_concurrency_line_remove_dto" +require_relative "vapi_server_sdk/types/hipaa_buy_dto" +require_relative "vapi_server_sdk/types/subscription_coupon_add_dto" require_relative "vapi_server_sdk/types/squad" +require_relative "vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type" +require_relative "vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan" +require_relative "vapi_server_sdk/types/trieve_knowledge_base_vector_store_create_plan" +require_relative "vapi_server_sdk/types/trieve_knowledge_base" +require_relative "vapi_server_sdk/types/custom_knowledge_base" +require_relative "vapi_server_sdk/types/create_trieve_knowledge_base_dto" require_relative "vapi_server_sdk/types/conversation_block_messages_item" require_relative "vapi_server_sdk/types/conversation_block" require_relative "vapi_server_sdk/types/tool_call_block_messages_item" @@ -247,14 +344,6 @@ require_relative "vapi_server_sdk/types/create_tool_call_block_dto_messages_item" require_relative "vapi_server_sdk/types/create_tool_call_block_dto_tool" require_relative "vapi_server_sdk/types/create_tool_call_block_dto" -require_relative "vapi_server_sdk/types/step_destination_conditions_item" -require_relative "vapi_server_sdk/types/step_destination" -require_relative "vapi_server_sdk/types/handoff_step_block" -require_relative "vapi_server_sdk/types/handoff_step" -require_relative "vapi_server_sdk/types/assignment_mutation_conditions_item" -require_relative "vapi_server_sdk/types/assignment_mutation" -require_relative "vapi_server_sdk/types/callback_step_block" -require_relative "vapi_server_sdk/types/callback_step" require_relative "vapi_server_sdk/types/create_workflow_block_dto_messages_item" require_relative "vapi_server_sdk/types/create_workflow_block_dto_steps_item" require_relative "vapi_server_sdk/types/create_workflow_block_dto" @@ -273,8 +362,20 @@ require_relative "vapi_server_sdk/types/transfer_call_tool" require_relative "vapi_server_sdk/types/output_tool_messages_item" require_relative "vapi_server_sdk/types/output_tool" +require_relative "vapi_server_sdk/types/bash_tool_messages_item" +require_relative "vapi_server_sdk/types/bash_tool" +require_relative "vapi_server_sdk/types/computer_tool_messages_item" +require_relative "vapi_server_sdk/types/computer_tool" +require_relative "vapi_server_sdk/types/text_editor_tool_messages_item" +require_relative "vapi_server_sdk/types/text_editor_tool" require_relative "vapi_server_sdk/types/create_output_tool_dto_messages_item" require_relative "vapi_server_sdk/types/create_output_tool_dto" +require_relative "vapi_server_sdk/types/create_bash_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/create_bash_tool_dto" +require_relative "vapi_server_sdk/types/create_computer_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/create_computer_tool_dto" +require_relative "vapi_server_sdk/types/create_text_editor_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/create_text_editor_tool_dto" require_relative "vapi_server_sdk/types/file_status" require_relative "vapi_server_sdk/types/file" require_relative "vapi_server_sdk/types/metrics" @@ -285,15 +386,22 @@ require_relative "vapi_server_sdk/types/analytics_operation" require_relative "vapi_server_sdk/types/analytics_query_group_by_item" require_relative "vapi_server_sdk/types/analytics_query" +require_relative "vapi_server_sdk/types/analytics_query_dto" require_relative "vapi_server_sdk/types/analytics_query_result" +require_relative "vapi_server_sdk/types/call_log_privileged_level" +require_relative "vapi_server_sdk/types/call_log_privileged" +require_relative "vapi_server_sdk/types/call_logs_paginated_response" require_relative "vapi_server_sdk/types/error" require_relative "vapi_server_sdk/types/log_type" require_relative "vapi_server_sdk/types/log_resource" require_relative "vapi_server_sdk/types/log_request_http_method" require_relative "vapi_server_sdk/types/log" require_relative "vapi_server_sdk/types/logs_paginated_response" -require_relative "vapi_server_sdk/types/anyscale_credential" require_relative "vapi_server_sdk/types/anthropic_credential" +require_relative "vapi_server_sdk/types/anyscale_credential" +require_relative "vapi_server_sdk/types/assembly_ai_credential" +require_relative "vapi_server_sdk/types/azure_credential_region" +require_relative "vapi_server_sdk/types/azure_credential" require_relative "vapi_server_sdk/types/azure_open_ai_credential_region" require_relative "vapi_server_sdk/types/azure_open_ai_credential_models_item" require_relative "vapi_server_sdk/types/azure_open_ai_credential" @@ -304,16 +412,21 @@ require_relative "vapi_server_sdk/types/sbc_configuration" require_relative "vapi_server_sdk/types/byo_sip_trunk_credential" require_relative "vapi_server_sdk/types/cartesia_credential" +require_relative "vapi_server_sdk/types/o_auth_2_authentication_plan" +require_relative "vapi_server_sdk/types/oauth_2_authentication_session" require_relative "vapi_server_sdk/types/custom_llm_credential" require_relative "vapi_server_sdk/types/deepgram_credential" +require_relative "vapi_server_sdk/types/deep_infra_credential" +require_relative "vapi_server_sdk/types/eleven_labs_credential" require_relative "vapi_server_sdk/types/gcp_key" require_relative "vapi_server_sdk/types/bucket_plan" require_relative "vapi_server_sdk/types/gcp_credential" require_relative "vapi_server_sdk/types/gladia_credential" -require_relative "vapi_server_sdk/types/deep_infra_credential" -require_relative "vapi_server_sdk/types/eleven_labs_credential" require_relative "vapi_server_sdk/types/go_high_level_credential" +require_relative "vapi_server_sdk/types/google_credential" require_relative "vapi_server_sdk/types/groq_credential" +require_relative "vapi_server_sdk/types/inflection_ai_credential" +require_relative "vapi_server_sdk/types/langfuse_credential" require_relative "vapi_server_sdk/types/lmnt_credential" require_relative "vapi_server_sdk/types/make_credential" require_relative "vapi_server_sdk/types/open_ai_credential" @@ -323,11 +436,17 @@ require_relative "vapi_server_sdk/types/rime_ai_credential" require_relative "vapi_server_sdk/types/runpod_credential" require_relative "vapi_server_sdk/types/s_3_credential" +require_relative "vapi_server_sdk/types/tavus_credential" require_relative "vapi_server_sdk/types/together_ai_credential" require_relative "vapi_server_sdk/types/twilio_credential" require_relative "vapi_server_sdk/types/vonage_credential" -require_relative "vapi_server_sdk/types/create_anyscale_credential_dto" +require_relative "vapi_server_sdk/types/webhook_credential" +require_relative "vapi_server_sdk/types/x_ai_credential" require_relative "vapi_server_sdk/types/create_anthropic_credential_dto" +require_relative "vapi_server_sdk/types/create_anyscale_credential_dto" +require_relative "vapi_server_sdk/types/create_assembly_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_azure_credential_dto_region" +require_relative "vapi_server_sdk/types/create_azure_credential_dto" require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_region" require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item" require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto" @@ -335,12 +454,15 @@ require_relative "vapi_server_sdk/types/create_cartesia_credential_dto" require_relative "vapi_server_sdk/types/create_custom_llm_credential_dto" require_relative "vapi_server_sdk/types/create_deepgram_credential_dto" -require_relative "vapi_server_sdk/types/create_gcp_credential_dto" -require_relative "vapi_server_sdk/types/create_gladia_credential_dto" require_relative "vapi_server_sdk/types/create_deep_infra_credential_dto" require_relative "vapi_server_sdk/types/create_eleven_labs_credential_dto" +require_relative "vapi_server_sdk/types/create_gcp_credential_dto" +require_relative "vapi_server_sdk/types/create_gladia_credential_dto" require_relative "vapi_server_sdk/types/create_go_high_level_credential_dto" +require_relative "vapi_server_sdk/types/create_google_credential_dto" require_relative "vapi_server_sdk/types/create_groq_credential_dto" +require_relative "vapi_server_sdk/types/create_inflection_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_langfuse_credential_dto" require_relative "vapi_server_sdk/types/create_lmnt_credential_dto" require_relative "vapi_server_sdk/types/create_make_credential_dto" require_relative "vapi_server_sdk/types/create_open_ai_credential_dto" @@ -350,24 +472,33 @@ require_relative "vapi_server_sdk/types/create_rime_ai_credential_dto" require_relative "vapi_server_sdk/types/create_runpod_credential_dto" require_relative "vapi_server_sdk/types/create_s_3_credential_dto" +require_relative "vapi_server_sdk/types/create_tavus_credential_dto" require_relative "vapi_server_sdk/types/create_together_ai_credential_dto" require_relative "vapi_server_sdk/types/create_twilio_credential_dto" require_relative "vapi_server_sdk/types/create_vonage_credential_dto" -require_relative "vapi_server_sdk/types/update_anyscale_credential_dto" +require_relative "vapi_server_sdk/types/create_webhook_credential_dto" +require_relative "vapi_server_sdk/types/create_x_ai_credential_dto" require_relative "vapi_server_sdk/types/update_anthropic_credential_dto" +require_relative "vapi_server_sdk/types/update_anyscale_credential_dto" +require_relative "vapi_server_sdk/types/update_assembly_ai_credential_dto" +require_relative "vapi_server_sdk/types/update_azure_credential_dto_region" +require_relative "vapi_server_sdk/types/update_azure_credential_dto" require_relative "vapi_server_sdk/types/update_azure_open_ai_credential_dto_region" require_relative "vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item" require_relative "vapi_server_sdk/types/update_azure_open_ai_credential_dto" require_relative "vapi_server_sdk/types/update_byo_sip_trunk_credential_dto" require_relative "vapi_server_sdk/types/update_cartesia_credential_dto" require_relative "vapi_server_sdk/types/update_custom_llm_credential_dto" -require_relative "vapi_server_sdk/types/update_deep_infra_credential_dto" require_relative "vapi_server_sdk/types/update_deepgram_credential_dto" +require_relative "vapi_server_sdk/types/update_deep_infra_credential_dto" +require_relative "vapi_server_sdk/types/update_eleven_labs_credential_dto" require_relative "vapi_server_sdk/types/update_gcp_credential_dto" require_relative "vapi_server_sdk/types/update_gladia_credential_dto" -require_relative "vapi_server_sdk/types/update_eleven_labs_credential_dto" require_relative "vapi_server_sdk/types/update_go_high_level_credential_dto" +require_relative "vapi_server_sdk/types/update_google_credential_dto" require_relative "vapi_server_sdk/types/update_groq_credential_dto" +require_relative "vapi_server_sdk/types/update_inflection_ai_credential_dto" +require_relative "vapi_server_sdk/types/update_langfuse_credential_dto" require_relative "vapi_server_sdk/types/update_lmnt_credential_dto" require_relative "vapi_server_sdk/types/update_make_credential_dto" require_relative "vapi_server_sdk/types/update_open_ai_credential_dto" @@ -377,16 +508,24 @@ require_relative "vapi_server_sdk/types/update_rime_ai_credential_dto" require_relative "vapi_server_sdk/types/update_runpod_credential_dto" require_relative "vapi_server_sdk/types/update_s_3_credential_dto" +require_relative "vapi_server_sdk/types/update_tavus_credential_dto" require_relative "vapi_server_sdk/types/update_together_ai_credential_dto" require_relative "vapi_server_sdk/types/update_twilio_credential_dto" require_relative "vapi_server_sdk/types/update_vonage_credential_dto" +require_relative "vapi_server_sdk/types/update_x_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_org_dto_channel" require_relative "vapi_server_sdk/types/create_org_dto" require_relative "vapi_server_sdk/types/org_plan" +require_relative "vapi_server_sdk/types/org_channel" require_relative "vapi_server_sdk/types/org" +require_relative "vapi_server_sdk/types/update_org_dto_channel" require_relative "vapi_server_sdk/types/update_org_dto" require_relative "vapi_server_sdk/types/user" require_relative "vapi_server_sdk/types/invite_user_dto_role" require_relative "vapi_server_sdk/types/invite_user_dto" +require_relative "vapi_server_sdk/types/org_with_org_user_channel" +require_relative "vapi_server_sdk/types/org_with_org_user_role" +require_relative "vapi_server_sdk/types/org_with_org_user" require_relative "vapi_server_sdk/types/update_user_role_dto_role" require_relative "vapi_server_sdk/types/update_user_role_dto" require_relative "vapi_server_sdk/types/voice_library_voice_response" @@ -434,11 +573,16 @@ require_relative "vapi_server_sdk/types/client_message_transcript" require_relative "vapi_server_sdk/types/tool_call_function" require_relative "vapi_server_sdk/types/tool_call" +require_relative "vapi_server_sdk/types/function_tool_with_tool_call" +require_relative "vapi_server_sdk/types/ghl_tool_with_tool_call" +require_relative "vapi_server_sdk/types/make_tool_with_tool_call" require_relative "vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item" require_relative "vapi_server_sdk/types/client_message_tool_calls" require_relative "vapi_server_sdk/types/client_message_tool_calls_result" +require_relative "vapi_server_sdk/types/client_message_transfer_update_destination" +require_relative "vapi_server_sdk/types/client_message_transfer_update" require_relative "vapi_server_sdk/types/client_message_user_interrupted" -require_relative "vapi_server_sdk/types/client_message_language_changed" +require_relative "vapi_server_sdk/types/client_message_language_change_detected" require_relative "vapi_server_sdk/types/client_message_voice_input" require_relative "vapi_server_sdk/types/client_message_message" require_relative "vapi_server_sdk/types/client_message" @@ -453,6 +597,9 @@ require_relative "vapi_server_sdk/types/server_message_end_of_call_report" require_relative "vapi_server_sdk/types/server_message_hang_phone_number" require_relative "vapi_server_sdk/types/server_message_hang" +require_relative "vapi_server_sdk/types/server_message_knowledge_base_request_phone_number" +require_relative "vapi_server_sdk/types/server_message_knowledge_base_request_messages_item" +require_relative "vapi_server_sdk/types/server_message_knowledge_base_request" require_relative "vapi_server_sdk/types/server_message_model_output_phone_number" require_relative "vapi_server_sdk/types/server_message_model_output" require_relative "vapi_server_sdk/types/server_message_phone_call_control_phone_number" @@ -483,8 +630,8 @@ require_relative "vapi_server_sdk/types/server_message_transcript" require_relative "vapi_server_sdk/types/server_message_user_interrupted_phone_number" require_relative "vapi_server_sdk/types/server_message_user_interrupted" -require_relative "vapi_server_sdk/types/server_message_language_changed_phone_number" -require_relative "vapi_server_sdk/types/server_message_language_changed" +require_relative "vapi_server_sdk/types/server_message_language_change_detected_phone_number" +require_relative "vapi_server_sdk/types/server_message_language_change_detected" require_relative "vapi_server_sdk/types/server_message_voice_input_phone_number" require_relative "vapi_server_sdk/types/server_message_voice_input" require_relative "vapi_server_sdk/types/server_message_voice_request_phone_number" @@ -493,6 +640,8 @@ require_relative "vapi_server_sdk/types/server_message" require_relative "vapi_server_sdk/types/server_message_response_assistant_request_destination" require_relative "vapi_server_sdk/types/server_message_response_assistant_request" +require_relative "vapi_server_sdk/types/knowledge_base_response_document" +require_relative "vapi_server_sdk/types/server_message_response_knowledge_base_request" require_relative "vapi_server_sdk/types/tool_call_result_message_item" require_relative "vapi_server_sdk/types/tool_call_result" require_relative "vapi_server_sdk/types/server_message_response_tool_calls" @@ -505,21 +654,30 @@ require_relative "vapi_server_sdk/types/client_inbound_message_control_control" require_relative "vapi_server_sdk/types/client_inbound_message_control" require_relative "vapi_server_sdk/types/client_inbound_message_say" +require_relative "vapi_server_sdk/types/client_inbound_message_transfer_destination" +require_relative "vapi_server_sdk/types/client_inbound_message_transfer" require_relative "vapi_server_sdk/types/client_inbound_message_message" require_relative "vapi_server_sdk/types/client_inbound_message" +require_relative "vapi_server_sdk/types/transport_cost_provider" require_relative "vapi_server_sdk/types/transport_cost" require_relative "vapi_server_sdk/types/transcriber_cost" require_relative "vapi_server_sdk/types/model_cost" require_relative "vapi_server_sdk/types/voice_cost" +require_relative "vapi_server_sdk/types/vapi_cost_sub_type" require_relative "vapi_server_sdk/types/vapi_cost" require_relative "vapi_server_sdk/types/analysis_cost_analysis_type" require_relative "vapi_server_sdk/types/analysis_cost" require_relative "vapi_server_sdk/types/function_tool_with_tool_call_messages_item" -require_relative "vapi_server_sdk/types/function_tool_with_tool_call" require_relative "vapi_server_sdk/types/ghl_tool_with_tool_call_messages_item" -require_relative "vapi_server_sdk/types/ghl_tool_with_tool_call" require_relative "vapi_server_sdk/types/make_tool_with_tool_call_messages_item" -require_relative "vapi_server_sdk/types/make_tool_with_tool_call" +require_relative "vapi_server_sdk/types/step_destination_conditions_item" +require_relative "vapi_server_sdk/types/step_destination" +require_relative "vapi_server_sdk/types/handoff_step_block" +require_relative "vapi_server_sdk/types/handoff_step" +require_relative "vapi_server_sdk/types/assignment_mutation_conditions_item" +require_relative "vapi_server_sdk/types/assignment_mutation" +require_relative "vapi_server_sdk/types/callback_step_block" +require_relative "vapi_server_sdk/types/callback_step" require_relative "vapi_server_sdk/types/deepgram_transcriber_language" require_relative "vapi_server_sdk/types/deepgram_transcriber_model" require_relative "vapi_server_sdk/types/transfer_mode" diff --git a/lib/vapi_server_sdk.rb b/lib/vapi_server_sdk.rb index ebb897b..14cda61 100644 --- a/lib/vapi_server_sdk.rb +++ b/lib/vapi_server_sdk.rb @@ -7,6 +7,7 @@ require_relative "vapi_server_sdk/assistants/client" require_relative "vapi_server_sdk/phone_numbers/client" require_relative "vapi_server_sdk/squads/client" +require_relative "vapi_server_sdk/knowledge_bases/client" require_relative "vapi_server_sdk/blocks/client" require_relative "vapi_server_sdk/tools/client" require_relative "vapi_server_sdk/files/client" @@ -23,6 +24,8 @@ class Client attr_reader :phone_numbers # @return [Vapi::SquadsClient] attr_reader :squads + # @return [Vapi::KnowledgeBasesClient] + attr_reader :knowledge_bases # @return [Vapi::BlocksClient] attr_reader :blocks # @return [Vapi::ToolsClient] @@ -53,6 +56,7 @@ def initialize(token:, base_url: nil, environment: Vapi::Environment::DEFAULT, m @assistants = Vapi::AssistantsClient.new(request_client: @request_client) @phone_numbers = Vapi::PhoneNumbersClient.new(request_client: @request_client) @squads = Vapi::SquadsClient.new(request_client: @request_client) + @knowledge_bases = Vapi::KnowledgeBasesClient.new(request_client: @request_client) @blocks = Vapi::BlocksClient.new(request_client: @request_client) @tools = Vapi::ToolsClient.new(request_client: @request_client) @files = Vapi::FilesClient.new(request_client: @request_client) @@ -70,6 +74,8 @@ class AsyncClient attr_reader :phone_numbers # @return [Vapi::AsyncSquadsClient] attr_reader :squads + # @return [Vapi::AsyncKnowledgeBasesClient] + attr_reader :knowledge_bases # @return [Vapi::AsyncBlocksClient] attr_reader :blocks # @return [Vapi::AsyncToolsClient] @@ -100,6 +106,7 @@ def initialize(token:, base_url: nil, environment: Vapi::Environment::DEFAULT, m @assistants = Vapi::AsyncAssistantsClient.new(request_client: @async_request_client) @phone_numbers = Vapi::AsyncPhoneNumbersClient.new(request_client: @async_request_client) @squads = Vapi::AsyncSquadsClient.new(request_client: @async_request_client) + @knowledge_bases = Vapi::AsyncKnowledgeBasesClient.new(request_client: @async_request_client) @blocks = Vapi::AsyncBlocksClient.new(request_client: @async_request_client) @tools = Vapi::AsyncToolsClient.new(request_client: @async_request_client) @files = Vapi::AsyncFilesClient.new(request_client: @async_request_client) diff --git a/lib/vapi_server_sdk/analytics/client.rb b/lib/vapi_server_sdk/analytics/client.rb index d893db2..9b825f1 100644 --- a/lib/vapi_server_sdk/analytics/client.rb +++ b/lib/vapi_server_sdk/analytics/client.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true require_relative "../../requests" -require_relative "../types/analytics_query" -require_relative "../types/analytics_query_result" -require "json" require "async" module Vapi @@ -17,27 +14,17 @@ def initialize(request_client:) @request_client = request_client end - # @param queries [Array] This is the list of metric queries you want to perform.Request of type Array, as a Hash - # * :table (String) - # * :group_by (Array) - # * :name (String) - # * :time_range (Hash) - # * :step (Vapi::TimeRangeStep) - # * :start (DateTime) - # * :end_ (DateTime) - # * :timezone (String) - # * :operations (Array) # @param request_options [Vapi::RequestOptions] - # @return [Array] + # @return [Void] # @example # api = Vapi::Client.new( # base_url: "https://api.example.com", # environment: Vapi::Environment::DEFAULT, # token: "YOUR_AUTH_TOKEN" # ) - # api.analytics.get(queries: [{ table: "call", name: "name", operations: [{ operation: SUM, column: ID }] }]) - def get(queries:, request_options: nil) - response = @request_client.conn.post do |req| + # api.analytics.get + def get(request_options: nil) + @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? req.headers = { @@ -48,14 +35,11 @@ def get(queries:, request_options: nil) unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { **(request_options&.additional_body_parameters || {}), queries: queries }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end req.url "#{@request_client.get_url(request_options: request_options)}/analytics" end - parsed_json = JSON.parse(response.body) - parsed_json&.map do |item| - item = item.to_json - Vapi::AnalyticsQueryResult.from_json(json_object: item) - end end end @@ -69,28 +53,18 @@ def initialize(request_client:) @request_client = request_client end - # @param queries [Array] This is the list of metric queries you want to perform.Request of type Array, as a Hash - # * :table (String) - # * :group_by (Array) - # * :name (String) - # * :time_range (Hash) - # * :step (Vapi::TimeRangeStep) - # * :start (DateTime) - # * :end_ (DateTime) - # * :timezone (String) - # * :operations (Array) # @param request_options [Vapi::RequestOptions] - # @return [Array] + # @return [Void] # @example # api = Vapi::Client.new( # base_url: "https://api.example.com", # environment: Vapi::Environment::DEFAULT, # token: "YOUR_AUTH_TOKEN" # ) - # api.analytics.get(queries: [{ table: "call", name: "name", operations: [{ operation: SUM, column: ID }] }]) - def get(queries:, request_options: nil) + # api.analytics.get + def get(request_options: nil) Async do - response = @request_client.conn.post do |req| + @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? req.headers = { @@ -101,14 +75,11 @@ def get(queries:, request_options: nil) unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { **(request_options&.additional_body_parameters || {}), queries: queries }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end req.url "#{@request_client.get_url(request_options: request_options)}/analytics" end - parsed_json = JSON.parse(response.body) - parsed_json&.map do |item| - item = item.to_json - Vapi::AnalyticsQueryResult.from_json(json_object: item) - end end end end diff --git a/lib/vapi_server_sdk/assistants/client.rb b/lib/vapi_server_sdk/assistants/client.rb index 27ef015..beaa278 100644 --- a/lib/vapi_server_sdk/assistants/client.rb +++ b/lib/vapi_server_sdk/assistants/client.rb @@ -20,6 +20,7 @@ require_relative "../types/start_speaking_plan" require_relative "../types/stop_speaking_plan" require_relative "../types/monitor_plan" +require_relative "../types/server" require "async" module Vapi @@ -93,6 +94,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -100,12 +102,10 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -118,8 +118,6 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -155,6 +153,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -167,6 +166,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Assistant] # @example @@ -258,6 +262,10 @@ def delete(id:, request_options: nil) # @param transcriber [Vapi::Assistants::UpdateAssistantDtoTranscriber] These are the options for the assistant's transcriber. # @param model [Vapi::Assistants::UpdateAssistantDtoModel] These are the options for the assistant's LLM. # @param voice [Vapi::Assistants::UpdateAssistantDtoVoice] These are the options for the assistant's voice. + # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. # @param first_message_mode [Vapi::Assistants::UpdateAssistantDtoFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -272,7 +280,7 @@ def delete(id:, request_options: nil) # the end of the call, you will still receive an end-of-call-report message to # store on your server. Defaults to false. # @param client_messages [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. # @param server_messages [Array] These are the messages that will be sent to your Server URL. Default is # h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. @@ -284,10 +292,6 @@ def delete(id:, request_options: nil) # @default 600 (10 minutes) # @param background_sound [Vapi::Assistants::UpdateAssistantDtoBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. - # @param backchanneling_enabled [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false # @param background_denoising_enabled [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -305,10 +309,6 @@ def delete(id:, request_options: nil) # * :recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels) # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. - # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. # @param voicemail_detection [Hash] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -331,16 +331,6 @@ def delete(id:, request_options: nil) # @param end_call_phrases [Array] This list contains phrases that, if spoken by the assistant, will trigger the # call to be hung up. Case insensitive. # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. # @param analysis_plan [Hash] This is the plan for analysis of assistant's calls. Stored in `call.analysis`.Request of type Vapi::AnalysisPlan, as a Hash # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -389,6 +379,7 @@ def delete(id:, request_options: nil) # - The assistant is so fast that it's actually interrupting the customer.Request of type Vapi::StartSpeakingPlan, as a Hash # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -419,6 +410,16 @@ def delete(id:, request_options: nil) # @param credential_ids [Array] These are the credentials that will be used for the assistant calls. By default, # all the credentials are available for use in the call but you can provide a # subset using this. + # @param server [Hash] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrlRequest of type Vapi::Server, as a Hash + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Assistant] # @example @@ -428,8 +429,8 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.assistants.update(id: "id") - def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: nil, hipaa_enabled: nil, - client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, backchanneling_enabled: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, first_message: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, server_url: nil, server_url_secret: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, request_options: nil) + def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, first_message_mode: nil, + hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -446,6 +447,7 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: ni transcriber: transcriber, model: model, voice: voice, + firstMessage: first_message, firstMessageMode: first_message_mode, hipaaEnabled: hipaa_enabled, clientMessages: client_messages, @@ -453,26 +455,23 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: ni silenceTimeoutSeconds: silence_timeout_seconds, maxDurationSeconds: max_duration_seconds, backgroundSound: background_sound, - backchannelingEnabled: backchanneling_enabled, backgroundDenoisingEnabled: background_denoising_enabled, modelOutputInMessagesEnabled: model_output_in_messages_enabled, transportConfigurations: transport_configurations, name: name, - firstMessage: first_message, voicemailDetection: voicemail_detection, voicemailMessage: voicemail_message, endCallMessage: end_call_message, endCallPhrases: end_call_phrases, metadata: metadata, - serverUrl: server_url, - serverUrlSecret: server_url_secret, analysisPlan: analysis_plan, artifactPlan: artifact_plan, messagePlan: message_plan, startSpeakingPlan: start_speaking_plan, stopSpeakingPlan: stop_speaking_plan, monitorPlan: monitor_plan, - credentialIds: credential_ids + credentialIds: credential_ids, + server: server }.compact req.url "#{@request_client.get_url(request_options: request_options)}/assistant/#{id}" end @@ -552,6 +551,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -559,12 +559,10 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -577,8 +575,6 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -614,6 +610,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -626,6 +623,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Assistant] # @example @@ -723,6 +725,10 @@ def delete(id:, request_options: nil) # @param transcriber [Vapi::Assistants::UpdateAssistantDtoTranscriber] These are the options for the assistant's transcriber. # @param model [Vapi::Assistants::UpdateAssistantDtoModel] These are the options for the assistant's LLM. # @param voice [Vapi::Assistants::UpdateAssistantDtoVoice] These are the options for the assistant's voice. + # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. # @param first_message_mode [Vapi::Assistants::UpdateAssistantDtoFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -737,7 +743,7 @@ def delete(id:, request_options: nil) # the end of the call, you will still receive an end-of-call-report message to # store on your server. Defaults to false. # @param client_messages [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. # @param server_messages [Array] These are the messages that will be sent to your Server URL. Default is # h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. @@ -749,10 +755,6 @@ def delete(id:, request_options: nil) # @default 600 (10 minutes) # @param background_sound [Vapi::Assistants::UpdateAssistantDtoBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. - # @param backchanneling_enabled [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false # @param background_denoising_enabled [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -770,10 +772,6 @@ def delete(id:, request_options: nil) # * :recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels) # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. - # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. # @param voicemail_detection [Hash] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -796,16 +794,6 @@ def delete(id:, request_options: nil) # @param end_call_phrases [Array] This list contains phrases that, if spoken by the assistant, will trigger the # call to be hung up. Case insensitive. # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. # @param analysis_plan [Hash] This is the plan for analysis of assistant's calls. Stored in `call.analysis`.Request of type Vapi::AnalysisPlan, as a Hash # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -854,6 +842,7 @@ def delete(id:, request_options: nil) # - The assistant is so fast that it's actually interrupting the customer.Request of type Vapi::StartSpeakingPlan, as a Hash # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -884,6 +873,16 @@ def delete(id:, request_options: nil) # @param credential_ids [Array] These are the credentials that will be used for the assistant calls. By default, # all the credentials are available for use in the call but you can provide a # subset using this. + # @param server [Hash] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrlRequest of type Vapi::Server, as a Hash + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Assistant] # @example @@ -893,8 +892,8 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.assistants.update(id: "id") - def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: nil, hipaa_enabled: nil, - client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, backchanneling_enabled: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, first_message: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, server_url: nil, server_url_secret: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, request_options: nil) + def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, first_message_mode: nil, + hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -912,6 +911,7 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: ni transcriber: transcriber, model: model, voice: voice, + firstMessage: first_message, firstMessageMode: first_message_mode, hipaaEnabled: hipaa_enabled, clientMessages: client_messages, @@ -919,26 +919,23 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message_mode: ni silenceTimeoutSeconds: silence_timeout_seconds, maxDurationSeconds: max_duration_seconds, backgroundSound: background_sound, - backchannelingEnabled: backchanneling_enabled, backgroundDenoisingEnabled: background_denoising_enabled, modelOutputInMessagesEnabled: model_output_in_messages_enabled, transportConfigurations: transport_configurations, name: name, - firstMessage: first_message, voicemailDetection: voicemail_detection, voicemailMessage: voicemail_message, endCallMessage: end_call_message, endCallPhrases: end_call_phrases, metadata: metadata, - serverUrl: server_url, - serverUrlSecret: server_url_secret, analysisPlan: analysis_plan, artifactPlan: artifact_plan, messagePlan: message_plan, startSpeakingPlan: start_speaking_plan, stopSpeakingPlan: stop_speaking_plan, monitorPlan: monitor_plan, - credentialIds: credential_ids + credentialIds: credential_ids, + server: server }.compact req.url "#{@request_client.get_url(request_options: request_options)}/assistant/#{id}" end diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_client_messages_item.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_client_messages_item.rb index c52377b..134bbbb 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_client_messages_item.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_client_messages_item.rb @@ -15,6 +15,7 @@ class UpdateAssistantDtoClientMessagesItem TRANSCRIPT = "transcript" TOOL_CALLS = "tool-calls" TOOL_CALLS_RESULT = "tool-calls-result" + TRANSFER_UPDATE = "transfer-update" USER_INTERRUPTED = "user-interrupted" VOICE_INPUT = "voice-input" end diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb index 9adce59..19574a4 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb @@ -5,12 +5,15 @@ require_relative "../../types/anthropic_model" require_relative "../../types/custom_llm_model" require_relative "../../types/deep_infra_model" +require_relative "../../types/google_model" require_relative "../../types/groq_model" +require_relative "../../types/inflection_ai_model" require_relative "../../types/open_ai_model" require_relative "../../types/open_router_model" require_relative "../../types/perplexity_ai_model" require_relative "../../types/together_ai_model" require_relative "../../types/vapi_model" +require_relative "../../types/xai_model" module Vapi class Assistants @@ -47,8 +50,12 @@ def self.from_json(json_object:) Vapi::CustomLlmModel.from_json(json_object: json_object) when "deepinfra" Vapi::DeepInfraModel.from_json(json_object: json_object) + when "google" + Vapi::GoogleModel.from_json(json_object: json_object) when "groq" Vapi::GroqModel.from_json(json_object: json_object) + when "inflection-ai" + Vapi::InflectionAiModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -59,6 +66,8 @@ def self.from_json(json_object:) Vapi::TogetherAiModel.from_json(json_object: json_object) when "vapi" Vapi::VapiModel.from_json(json_object: json_object) + when "xai" + Vapi::XaiModel.from_json(json_object: json_object) else Vapi::AnyscaleModel.from_json(json_object: json_object) end @@ -78,8 +87,12 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "deepinfra" { **@member.to_json, provider: @discriminant }.to_json + when "google" + { **@member.to_json, provider: @discriminant }.to_json when "groq" { **@member.to_json, provider: @discriminant }.to_json + when "inflection-ai" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -90,6 +103,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "vapi" { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -112,8 +127,12 @@ def self.validate_raw(obj:) Vapi::CustomLlmModel.validate_raw(obj: obj) when "deepinfra" Vapi::DeepInfraModel.validate_raw(obj: obj) + when "google" + Vapi::GoogleModel.validate_raw(obj: obj) when "groq" Vapi::GroqModel.validate_raw(obj: obj) + when "inflection-ai" + Vapi::InflectionAiModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -124,6 +143,8 @@ def self.validate_raw(obj:) Vapi::TogetherAiModel.validate_raw(obj: obj) when "vapi" Vapi::VapiModel.validate_raw(obj: obj) + when "xai" + Vapi::XaiModel.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -161,12 +182,24 @@ def self.deepinfra(member:) new(member: member, discriminant: "deepinfra") end + # @param member [Vapi::GoogleModel] + # @return [Vapi::Assistants::UpdateAssistantDtoModel] + def self.google(member:) + new(member: member, discriminant: "google") + end + # @param member [Vapi::GroqModel] # @return [Vapi::Assistants::UpdateAssistantDtoModel] def self.groq(member:) new(member: member, discriminant: "groq") end + # @param member [Vapi::InflectionAiModel] + # @return [Vapi::Assistants::UpdateAssistantDtoModel] + def self.inflection_ai(member:) + new(member: member, discriminant: "inflection-ai") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::Assistants::UpdateAssistantDtoModel] def self.openai(member:) @@ -196,6 +229,12 @@ def self.together_ai(member:) def self.vapi(member:) new(member: member, discriminant: "vapi") end + + # @param member [Vapi::XaiModel] + # @return [Vapi::Assistants::UpdateAssistantDtoModel] + def self.xai(member:) + new(member: member, discriminant: "xai") + end end end end diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb index a209249..5f39c77 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb @@ -8,6 +8,7 @@ class UpdateAssistantDtoServerMessagesItem FUNCTION_CALL = "function-call" HANG = "hang" LANGUAGE_CHANGED = "language-changed" + LANGUAGE_CHANGE_DETECTED = "language-change-detected" MODEL_OUTPUT = "model-output" PHONE_CALL_CONTROL = "phone-call-control" SPEECH_UPDATE = "speech-update" diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb index 3bc2579..04e1e22 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require "json" +require_relative "../../types/assembly_ai_transcriber" +require_relative "../../types/custom_transcriber" require_relative "../../types/deepgram_transcriber" require_relative "../../types/gladia_transcriber" require_relative "../../types/talkscriber_transcriber" @@ -32,6 +34,10 @@ def initialize(member:, discriminant:) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "custom-transcriber" + Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramTranscriber.from_json(json_object: json_object) when "gladia" @@ -39,7 +45,7 @@ def self.from_json(json_object:) when "talkscriber" Vapi::TalkscriberTranscriber.from_json(json_object: json_object) else - Vapi::DeepgramTranscriber.from_json(json_object: json_object) + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) end new(member: member, discriminant: struct.provider) end @@ -49,6 +55,10 @@ def self.from_json(json_object:) # @return [String] def to_json(*_args) case @discriminant + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-transcriber" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "gladia" @@ -69,6 +79,10 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) case obj.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "custom-transcriber" + Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramTranscriber.validate_raw(obj: obj) when "gladia" @@ -88,6 +102,18 @@ def is_a?(obj) @member.is_a?(obj) end + # @param member [Vapi::AssemblyAiTranscriber] + # @return [Vapi::Assistants::UpdateAssistantDtoTranscriber] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CustomTranscriber] + # @return [Vapi::Assistants::UpdateAssistantDtoTranscriber] + def self.custom_transcriber(member:) + new(member: member, discriminant: "custom-transcriber") + end + # @param member [Vapi::DeepgramTranscriber] # @return [Vapi::Assistants::UpdateAssistantDtoTranscriber] def self.deepgram(member:) diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb index 39c06f7..26e36c3 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb @@ -3,6 +3,7 @@ require "json" require_relative "../../types/azure_voice" require_relative "../../types/cartesia_voice" +require_relative "../../types/custom_voice" require_relative "../../types/deepgram_voice" require_relative "../../types/eleven_labs_voice" require_relative "../../types/lmnt_voice" @@ -10,6 +11,7 @@ require_relative "../../types/open_ai_voice" require_relative "../../types/play_ht_voice" require_relative "../../types/rime_ai_voice" +require_relative "../../types/tavus_voice" module Vapi class Assistants @@ -42,6 +44,8 @@ def self.from_json(json_object:) Vapi::AzureVoice.from_json(json_object: json_object) when "cartesia" Vapi::CartesiaVoice.from_json(json_object: json_object) + when "custom-voice" + Vapi::CustomVoice.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramVoice.from_json(json_object: json_object) when "11labs" @@ -56,6 +60,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "tavus" + Vapi::TavusVoice.from_json(json_object: json_object) else Vapi::AzureVoice.from_json(json_object: json_object) end @@ -71,6 +77,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "cartesia" { **@member.to_json, provider: @discriminant }.to_json + when "custom-voice" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "11labs" @@ -85,6 +93,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -103,6 +113,8 @@ def self.validate_raw(obj:) Vapi::AzureVoice.validate_raw(obj: obj) when "cartesia" Vapi::CartesiaVoice.validate_raw(obj: obj) + when "custom-voice" + Vapi::CustomVoice.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramVoice.validate_raw(obj: obj) when "11labs" @@ -117,6 +129,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "tavus" + Vapi::TavusVoice.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -142,6 +156,12 @@ def self.cartesia(member:) new(member: member, discriminant: "cartesia") end + # @param member [Vapi::CustomVoice] + # @return [Vapi::Assistants::UpdateAssistantDtoVoice] + def self.custom_voice(member:) + new(member: member, discriminant: "custom-voice") + end + # @param member [Vapi::DeepgramVoice] # @return [Vapi::Assistants::UpdateAssistantDtoVoice] def self.deepgram(member:) @@ -183,6 +203,12 @@ def self.playht(member:) def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + + # @param member [Vapi::TavusVoice] + # @return [Vapi::Assistants::UpdateAssistantDtoVoice] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end end end end diff --git a/lib/vapi_server_sdk/calls/client.rb b/lib/vapi_server_sdk/calls/client.rb index a353689..bcbeb41 100644 --- a/lib/vapi_server_sdk/calls/client.rb +++ b/lib/vapi_server_sdk/calls/client.rb @@ -22,7 +22,11 @@ def initialize(request_client:) @request_client = request_client end + # @param id [String] This is the unique identifier for the call. # @param assistant_id [String] This will return calls with the specified assistantId. + # @param phone_number_id [String] This is the phone number that will be used for the call. To use a transient + # number, use `phoneNumber` instead. + # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. # @param limit [Float] This is the maximum number of items to return. Defaults to 100. # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. # @param created_at_lt [DateTime] This will return items where the createdAt is less than the specified value. @@ -45,8 +49,8 @@ def initialize(request_client:) # token: "YOUR_AUTH_TOKEN" # ) # api.calls.list - def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, - created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, + created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) response = @request_client.conn.get do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -57,7 +61,9 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, }.compact req.params = { **(request_options&.additional_query_parameters || {}), + "id": id, "assistantId": assistant_id, + "phoneNumberId": phone_number_id, "limit": limit, "createdAtGt": created_at_gt, "createdAtLt": created_at_lt, @@ -88,6 +94,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -95,12 +102,10 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -113,8 +118,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -150,6 +153,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -162,11 +166,17 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param assistant_overrides [Hash] These are the overrides for the `assistant` or `assistantId`'s settings and # template variables.Request of type Vapi::AssistantOverrides, as a Hash # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -174,13 +184,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -193,8 +201,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -230,6 +236,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -242,6 +249,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param squad_id [String] This is the squad that will be used for the call. To use a transient squad, use # `squad` instead. # @param squad [Hash] This is a squad that will be used for the call. To use an existing squad, use @@ -252,6 +264,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -259,13 +272,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -278,8 +289,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -315,6 +324,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -327,6 +337,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param phone_number_id [String] This is the phone number that will be used for the call. To use a transient # number, use `phoneNumber` instead. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. @@ -493,7 +508,11 @@ def initialize(request_client:) @request_client = request_client end + # @param id [String] This is the unique identifier for the call. # @param assistant_id [String] This will return calls with the specified assistantId. + # @param phone_number_id [String] This is the phone number that will be used for the call. To use a transient + # number, use `phoneNumber` instead. + # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. # @param limit [Float] This is the maximum number of items to return. Defaults to 100. # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. # @param created_at_lt [DateTime] This will return items where the createdAt is less than the specified value. @@ -516,8 +535,8 @@ def initialize(request_client:) # token: "YOUR_AUTH_TOKEN" # ) # api.calls.list - def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, - created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, + created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -529,7 +548,9 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, }.compact req.params = { **(request_options&.additional_query_parameters || {}), + "id": id, "assistantId": assistant_id, + "phoneNumberId": phone_number_id, "limit": limit, "createdAtGt": created_at_gt, "createdAtLt": created_at_lt, @@ -561,6 +582,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -568,12 +590,10 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -586,8 +606,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -623,6 +641,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -635,11 +654,17 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param assistant_overrides [Hash] These are the overrides for the `assistant` or `assistantId`'s settings and # template variables.Request of type Vapi::AssistantOverrides, as a Hash # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -647,13 +672,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -666,8 +689,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -703,6 +724,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -715,6 +737,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param squad_id [String] This is the squad that will be used for the call. To use a transient squad, use # `squad` instead. # @param squad [Hash] This is a squad that will be used for the call. To use an existing squad, use @@ -725,6 +752,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -732,13 +760,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -751,8 +777,6 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -788,6 +812,7 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -800,6 +825,11 @@ def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param phone_number_id [String] This is the phone number that will be used for the call. To use a transient # number, use `phoneNumber` instead. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. diff --git a/lib/vapi_server_sdk/knowledge_bases/client.rb b/lib/vapi_server_sdk/knowledge_bases/client.rb new file mode 100644 index 0000000..6741499 --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/client.rb @@ -0,0 +1,394 @@ +# frozen_string_literal: true + +require_relative "../../requests" +require "date" +require_relative "types/knowledge_bases_list_response_item" +require "json" +require_relative "types/knowledge_bases_create_request" +require_relative "types/knowledge_bases_create_response" +require_relative "types/knowledge_bases_get_response" +require_relative "types/knowledge_bases_delete_response" +require_relative "types/knowledge_bases_update_response" +require "async" + +module Vapi + class KnowledgeBasesClient + # @return [Vapi::RequestClient] + attr_reader :request_client + + # @param request_client [Vapi::RequestClient] + # @return [Vapi::KnowledgeBasesClient] + def initialize(request_client:) + @request_client = request_client + end + + # @param limit [Float] This is the maximum number of items to return. Defaults to 100. + # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. + # @param created_at_lt [DateTime] This will return items where the createdAt is less than the specified value. + # @param created_at_ge [DateTime] This will return items where the createdAt is greater than or equal to the + # specified value. + # @param created_at_le [DateTime] This will return items where the createdAt is less than or equal to the + # specified value. + # @param updated_at_gt [DateTime] This will return items where the updatedAt is greater than the specified value. + # @param updated_at_lt [DateTime] This will return items where the updatedAt is less than the specified value. + # @param updated_at_ge [DateTime] This will return items where the updatedAt is greater than or equal to the + # specified value. + # @param updated_at_le [DateTime] This will return items where the updatedAt is less than or equal to the + # specified value. + # @param request_options [Vapi::RequestOptions] + # @return [Array] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.list + def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, + updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + response = @request_client.conn.get do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + req.params = { + **(request_options&.additional_query_parameters || {}), + "limit": limit, + "createdAtGt": created_at_gt, + "createdAtLt": created_at_lt, + "createdAtGe": created_at_ge, + "createdAtLe": created_at_le, + "updatedAtGt": updated_at_gt, + "updatedAtLt": updated_at_lt, + "updatedAtGe": updated_at_ge, + "updatedAtLe": updated_at_le + }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base" + end + parsed_json = JSON.parse(response.body) + parsed_json&.map do |item| + item = item.to_json + Vapi::KnowledgeBases::KnowledgeBasesListResponseItem.from_json(json_object: item) + end + end + + # @param request [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.create + def create(request:, request_options: nil) + response = @request_client.conn.post do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base" + end + Vapi::KnowledgeBases::KnowledgeBasesCreateResponse.from_json(json_object: response.body) + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.get(id: "id") + def get(id:, request_options: nil) + response = @request_client.conn.get do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesGetResponse.from_json(json_object: response.body) + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.delete(id: "id") + def delete(id:, request_options: nil) + response = @request_client.conn.delete do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse.from_json(json_object: response.body) + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.update(id: "id") + def update(id:, request_options: nil) + response = @request_client.conn.patch do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse.from_json(json_object: response.body) + end + end + + class AsyncKnowledgeBasesClient + # @return [Vapi::AsyncRequestClient] + attr_reader :request_client + + # @param request_client [Vapi::AsyncRequestClient] + # @return [Vapi::AsyncKnowledgeBasesClient] + def initialize(request_client:) + @request_client = request_client + end + + # @param limit [Float] This is the maximum number of items to return. Defaults to 100. + # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. + # @param created_at_lt [DateTime] This will return items where the createdAt is less than the specified value. + # @param created_at_ge [DateTime] This will return items where the createdAt is greater than or equal to the + # specified value. + # @param created_at_le [DateTime] This will return items where the createdAt is less than or equal to the + # specified value. + # @param updated_at_gt [DateTime] This will return items where the updatedAt is greater than the specified value. + # @param updated_at_lt [DateTime] This will return items where the updatedAt is less than the specified value. + # @param updated_at_ge [DateTime] This will return items where the updatedAt is greater than or equal to the + # specified value. + # @param updated_at_le [DateTime] This will return items where the updatedAt is less than or equal to the + # specified value. + # @param request_options [Vapi::RequestOptions] + # @return [Array] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.list + def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, + updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + Async do + response = @request_client.conn.get do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + req.params = { + **(request_options&.additional_query_parameters || {}), + "limit": limit, + "createdAtGt": created_at_gt, + "createdAtLt": created_at_lt, + "createdAtGe": created_at_ge, + "createdAtLe": created_at_le, + "updatedAtGt": updated_at_gt, + "updatedAtLt": updated_at_lt, + "updatedAtGe": updated_at_ge, + "updatedAtLe": updated_at_le + }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base" + end + parsed_json = JSON.parse(response.body) + parsed_json&.map do |item| + item = item.to_json + Vapi::KnowledgeBases::KnowledgeBasesListResponseItem.from_json(json_object: item) + end + end + end + + # @param request [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.create + def create(request:, request_options: nil) + Async do + response = @request_client.conn.post do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base" + end + Vapi::KnowledgeBases::KnowledgeBasesCreateResponse.from_json(json_object: response.body) + end + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.get(id: "id") + def get(id:, request_options: nil) + Async do + response = @request_client.conn.get do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesGetResponse.from_json(json_object: response.body) + end + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.delete(id: "id") + def delete(id:, request_options: nil) + Async do + response = @request_client.conn.delete do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse.from_json(json_object: response.body) + end + end + + # @param id [String] + # @param request_options [Vapi::RequestOptions] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.knowledge_bases.update(id: "id") + def update(id:, request_options: nil) + Async do + response = @request_client.conn.patch do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + unless request_options.nil? || request_options&.additional_query_parameters.nil? + req.params = { **(request_options&.additional_query_parameters || {}) }.compact + end + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" + end + Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse.from_json(json_object: response.body) + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request.rb new file mode 100644 index 0000000..c240fbb --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/create_trieve_knowledge_base_dto" +require_relative "../../types/create_custom_knowledge_base_dto" + +module Vapi + class KnowledgeBases + class KnowledgeBasesCreateRequest + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesCreateRequest + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::CreateTrieveKnowledgeBaseDto.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: json_object) + else + Vapi::CreateTrieveKnowledgeBaseDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::CreateTrieveKnowledgeBaseDto.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateTrieveKnowledgeBaseDto] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CreateCustomKnowledgeBaseDto] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateRequest] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response.rb new file mode 100644 index 0000000..b804989 --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/trieve_knowledge_base" +require_relative "../../types/custom_knowledge_base" + +module Vapi + class KnowledgeBases + class KnowledgeBasesCreateResponse + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesCreateResponse + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.from_json(json_object: json_object) + else + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::TrieveKnowledgeBase.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TrieveKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CustomKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesCreateResponse] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response.rb new file mode 100644 index 0000000..b250f6e --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/trieve_knowledge_base" +require_relative "../../types/custom_knowledge_base" + +module Vapi + class KnowledgeBases + class KnowledgeBasesDeleteResponse + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesDeleteResponse + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.from_json(json_object: json_object) + else + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::TrieveKnowledgeBase.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TrieveKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CustomKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesDeleteResponse] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response.rb new file mode 100644 index 0000000..0a87b2e --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/trieve_knowledge_base" +require_relative "../../types/custom_knowledge_base" + +module Vapi + class KnowledgeBases + class KnowledgeBasesGetResponse + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesGetResponse + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.from_json(json_object: json_object) + else + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::TrieveKnowledgeBase.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TrieveKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CustomKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesGetResponse] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item.rb new file mode 100644 index 0000000..a2dae7b --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/trieve_knowledge_base" +require_relative "../../types/custom_knowledge_base" + +module Vapi + class KnowledgeBases + class KnowledgeBasesListResponseItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesListResponseItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesListResponseItem + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesListResponseItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.from_json(json_object: json_object) + else + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::TrieveKnowledgeBase.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TrieveKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesListResponseItem] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CustomKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesListResponseItem] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response.rb new file mode 100644 index 0000000..932bb17 --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/trieve_knowledge_base" +require_relative "../../types/custom_knowledge_base" + +module Vapi + class KnowledgeBases + class KnowledgeBasesUpdateResponse + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesUpdateResponse + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.from_json(json_object: json_object) + else + Vapi::TrieveKnowledgeBase.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::TrieveKnowledgeBase.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::CustomKnowledgeBase.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TrieveKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::CustomKnowledgeBase] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/logs/client.rb b/lib/vapi_server_sdk/logs/client.rb index cbcdc21..dca8343 100644 --- a/lib/vapi_server_sdk/logs/client.rb +++ b/lib/vapi_server_sdk/logs/client.rb @@ -20,12 +20,13 @@ def initialize(request_client:) # @param org_id [String] This is the unique identifier for the org that this log belongs to. # @param type [Vapi::Logs::LogsGetRequestType] This is the type of the log. + # @param webhook_type [String] This is the type of the webhook, given the log is from a webhook. # @param assistant_id [String] This is the ID of the assistant. # @param phone_number_id [String] This is the ID of the phone number. # @param customer_id [String] This is the ID of the customer. # @param squad_id [String] This is the ID of the squad. # @param call_id [String] This is the ID of the call. - # @param page [Integer] This is the page number to return. Defaults to 1. + # @param page [Float] This is the page number to return. Defaults to 1. # @param sort_order [Vapi::Logs::LogsGetRequestSortOrder] This is the sort order for pagination. Defaults to 'ASC'. # @param limit [Float] This is the maximum number of items to return. Defaults to 100. # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. @@ -49,8 +50,8 @@ def initialize(request_client:) # token: "YOUR_AUTH_TOKEN" # ) # api.logs.get - def get(org_id: nil, type: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, squad_id: nil, - call_id: nil, page: nil, sort_order: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + def get(org_id: nil, type: nil, webhook_type: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, + squad_id: nil, call_id: nil, page: nil, sort_order: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) response = @request_client.conn.get do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -63,6 +64,7 @@ def get(org_id: nil, type: nil, assistant_id: nil, phone_number_id: nil, custome **(request_options&.additional_query_parameters || {}), "orgId": org_id, "type": type, + "webhookType": webhook_type, "assistantId": assistant_id, "phoneNumberId": phone_number_id, "customerId": customer_id, @@ -101,12 +103,13 @@ def initialize(request_client:) # @param org_id [String] This is the unique identifier for the org that this log belongs to. # @param type [Vapi::Logs::LogsGetRequestType] This is the type of the log. + # @param webhook_type [String] This is the type of the webhook, given the log is from a webhook. # @param assistant_id [String] This is the ID of the assistant. # @param phone_number_id [String] This is the ID of the phone number. # @param customer_id [String] This is the ID of the customer. # @param squad_id [String] This is the ID of the squad. # @param call_id [String] This is the ID of the call. - # @param page [Integer] This is the page number to return. Defaults to 1. + # @param page [Float] This is the page number to return. Defaults to 1. # @param sort_order [Vapi::Logs::LogsGetRequestSortOrder] This is the sort order for pagination. Defaults to 'ASC'. # @param limit [Float] This is the maximum number of items to return. Defaults to 100. # @param created_at_gt [DateTime] This will return items where the createdAt is greater than the specified value. @@ -130,8 +133,8 @@ def initialize(request_client:) # token: "YOUR_AUTH_TOKEN" # ) # api.logs.get - def get(org_id: nil, type: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, squad_id: nil, - call_id: nil, page: nil, sort_order: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) + def get(org_id: nil, type: nil, webhook_type: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, + squad_id: nil, call_id: nil, page: nil, sort_order: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -145,6 +148,7 @@ def get(org_id: nil, type: nil, assistant_id: nil, phone_number_id: nil, custome **(request_options&.additional_query_parameters || {}), "orgId": org_id, "type": type, + "webhookType": webhook_type, "assistantId": assistant_id, "phoneNumberId": phone_number_id, "customerId": customer_id, diff --git a/lib/vapi_server_sdk/squads/client.rb b/lib/vapi_server_sdk/squads/client.rb index 2329672..dfd0b6a 100644 --- a/lib/vapi_server_sdk/squads/client.rb +++ b/lib/vapi_server_sdk/squads/client.rb @@ -83,6 +83,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -90,13 +91,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -109,8 +108,6 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -146,6 +143,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -158,6 +156,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Squad] # @example @@ -254,6 +257,7 @@ def delete(id:, request_options: nil) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -261,12 +265,10 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -279,8 +281,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -316,6 +316,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -328,10 +329,16 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # * :assistant_overrides (Hash) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -339,13 +346,11 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -358,8 +363,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -395,6 +398,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -407,6 +411,11 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # * :assistant_destinations (Array) # @param members_overrides [Hash] This can be used to override all the assistants' settings and provide values for # their template variables. @@ -416,6 +425,7 @@ def delete(id:, request_options: nil) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -423,13 +433,11 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -442,8 +450,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -479,6 +485,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -491,6 +498,11 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Squad] # @example @@ -599,6 +611,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -606,13 +619,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -625,8 +636,6 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -662,6 +671,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -674,6 +684,11 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Squad] # @example @@ -776,6 +791,7 @@ def delete(id:, request_options: nil) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -783,12 +799,10 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::CreateAssistantDtoBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -801,8 +815,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -838,6 +850,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -850,10 +863,16 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # * :assistant_overrides (Hash) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -861,13 +880,11 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -880,8 +897,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -917,6 +932,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -929,6 +945,11 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # * :assistant_destinations (Array) # @param members_overrides [Hash] This can be used to override all the assistants' settings and provide values for # their template variables. @@ -938,6 +959,7 @@ def delete(id:, request_options: nil) # * :transcriber (Hash) # * :model (Hash) # * :voice (Hash) + # * :first_message (String) # * :first_message_mode (Vapi::AssistantOverridesFirstMessageMode) # * :hipaa_enabled (Boolean) # * :client_messages (Array) @@ -945,13 +967,11 @@ def delete(id:, request_options: nil) # * :silence_timeout_seconds (Float) # * :max_duration_seconds (Float) # * :background_sound (Vapi::AssistantOverridesBackgroundSound) - # * :backchanneling_enabled (Boolean) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) # * :variable_values (Hash{String => Object}) # * :name (String) - # * :first_message (String) # * :voicemail_detection (Hash) # * :provider (String) # * :voicemail_detection_types (Array) @@ -964,8 +984,6 @@ def delete(id:, request_options: nil) # * :end_call_message (String) # * :end_call_phrases (Array) # * :metadata (Hash{String => Object}) - # * :server_url (String) - # * :server_url_secret (String) # * :analysis_plan (Hash) # * :summary_plan (Hash) # * :messages (Array Object}>) @@ -1001,6 +1019,7 @@ def delete(id:, request_options: nil) # * :start_speaking_plan (Hash) # * :wait_seconds (Float) # * :smart_endpointing_enabled (Boolean) + # * :custom_endpointing_rules (Array) # * :transcription_endpointing_plan (Hash) # * :on_punctuation_seconds (Float) # * :on_no_punctuation_seconds (Float) @@ -1013,6 +1032,11 @@ def delete(id:, request_options: nil) # * :listen_enabled (Boolean) # * :control_enabled (Boolean) # * :credential_ids (Array) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Squad] # @example diff --git a/lib/vapi_server_sdk/tools/client.rb b/lib/vapi_server_sdk/tools/client.rb index 7a98e72..f17ea2a 100644 --- a/lib/vapi_server_sdk/tools/client.rb +++ b/lib/vapi_server_sdk/tools/client.rb @@ -189,6 +189,7 @@ def delete(id:, request_options: nil) # argument "reason". Then, in `messages` array, you can have many # "request-complete" messages. One of these messages will be triggered if the # `messages[].conditions` matches the "reason" argument.Request of type Vapi::OpenAiFunction, as a Hash + # * :strict (Boolean) # * :name (String) # * :description (String) # * :parameters (Hash) @@ -204,6 +205,7 @@ def delete(id:, request_options: nil) # * :timeout_seconds (Float) # * :url (String) # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Tools::ToolsUpdateResponse] # @example @@ -420,6 +422,7 @@ def delete(id:, request_options: nil) # argument "reason". Then, in `messages` array, you can have many # "request-complete" messages. One of these messages will be triggered if the # `messages[].conditions` matches the "reason" argument.Request of type Vapi::OpenAiFunction, as a Hash + # * :strict (Boolean) # * :name (String) # * :description (String) # * :parameters (Hash) @@ -435,6 +438,7 @@ def delete(id:, request_options: nil) # * :timeout_seconds (Float) # * :url (String) # * :secret (String) + # * :headers (Hash{String => Object}) # @param request_options [Vapi::RequestOptions] # @return [Vapi::Tools::ToolsUpdateResponse] # @example diff --git a/lib/vapi_server_sdk/tools/types/tools_create_request.rb b/lib/vapi_server_sdk/tools/types/tools_create_request.rb index 35b1643..f9eb25a 100644 --- a/lib/vapi_server_sdk/tools/types/tools_create_request.rb +++ b/lib/vapi_server_sdk/tools/types/tools_create_request.rb @@ -8,6 +8,9 @@ require_relative "../../types/create_make_tool_dto" require_relative "../../types/create_transfer_call_tool_dto" require_relative "../../types/create_output_tool_dto" +require_relative "../../types/create_bash_tool_dto" +require_relative "../../types/create_computer_tool_dto" +require_relative "../../types/create_text_editor_tool_dto" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) when "output" Vapi::CreateOutputToolDto.from_json(json_object: json_object) + when "bash" + Vapi::CreateBashToolDto.from_json(json_object: json_object) + when "computer" + Vapi::CreateComputerToolDto.from_json(json_object: json_object) + when "textEditor" + Vapi::CreateTextEditorToolDto.from_json(json_object: json_object) else Vapi::CreateDtmfToolDto.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) when "output" Vapi::CreateOutputToolDto.validate_raw(obj: obj) + when "bash" + Vapi::CreateBashToolDto.validate_raw(obj: obj) + when "computer" + Vapi::CreateComputerToolDto.validate_raw(obj: obj) + when "textEditor" + Vapi::CreateTextEditorToolDto.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::CreateBashToolDto] + # @return [Vapi::Tools::ToolsCreateRequest] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::CreateComputerToolDto] + # @return [Vapi::Tools::ToolsCreateRequest] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::CreateTextEditorToolDto] + # @return [Vapi::Tools::ToolsCreateRequest] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/tools/types/tools_create_response.rb b/lib/vapi_server_sdk/tools/types/tools_create_response.rb index 9d66cd5..58ac982 100644 --- a/lib/vapi_server_sdk/tools/types/tools_create_response.rb +++ b/lib/vapi_server_sdk/tools/types/tools_create_response.rb @@ -8,6 +8,9 @@ require_relative "../../types/make_tool" require_relative "../../types/transfer_call_tool" require_relative "../../types/output_tool" +require_relative "../../types/bash_tool" +require_relative "../../types/computer_tool" +require_relative "../../types/text_editor_tool" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::TransferCallTool.from_json(json_object: json_object) when "output" Vapi::OutputTool.from_json(json_object: json_object) + when "bash" + Vapi::BashTool.from_json(json_object: json_object) + when "computer" + Vapi::ComputerTool.from_json(json_object: json_object) + when "textEditor" + Vapi::TextEditorTool.from_json(json_object: json_object) else Vapi::DtmfTool.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::TransferCallTool.validate_raw(obj: obj) when "output" Vapi::OutputTool.validate_raw(obj: obj) + when "bash" + Vapi::BashTool.validate_raw(obj: obj) + when "computer" + Vapi::ComputerTool.validate_raw(obj: obj) + when "textEditor" + Vapi::TextEditorTool.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::BashTool] + # @return [Vapi::Tools::ToolsCreateResponse] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::ComputerTool] + # @return [Vapi::Tools::ToolsCreateResponse] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::TextEditorTool] + # @return [Vapi::Tools::ToolsCreateResponse] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/tools/types/tools_delete_response.rb b/lib/vapi_server_sdk/tools/types/tools_delete_response.rb index 258e32e..71bd591 100644 --- a/lib/vapi_server_sdk/tools/types/tools_delete_response.rb +++ b/lib/vapi_server_sdk/tools/types/tools_delete_response.rb @@ -8,6 +8,9 @@ require_relative "../../types/make_tool" require_relative "../../types/transfer_call_tool" require_relative "../../types/output_tool" +require_relative "../../types/bash_tool" +require_relative "../../types/computer_tool" +require_relative "../../types/text_editor_tool" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::TransferCallTool.from_json(json_object: json_object) when "output" Vapi::OutputTool.from_json(json_object: json_object) + when "bash" + Vapi::BashTool.from_json(json_object: json_object) + when "computer" + Vapi::ComputerTool.from_json(json_object: json_object) + when "textEditor" + Vapi::TextEditorTool.from_json(json_object: json_object) else Vapi::DtmfTool.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::TransferCallTool.validate_raw(obj: obj) when "output" Vapi::OutputTool.validate_raw(obj: obj) + when "bash" + Vapi::BashTool.validate_raw(obj: obj) + when "computer" + Vapi::ComputerTool.validate_raw(obj: obj) + when "textEditor" + Vapi::TextEditorTool.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::BashTool] + # @return [Vapi::Tools::ToolsDeleteResponse] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::ComputerTool] + # @return [Vapi::Tools::ToolsDeleteResponse] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::TextEditorTool] + # @return [Vapi::Tools::ToolsDeleteResponse] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/tools/types/tools_get_response.rb b/lib/vapi_server_sdk/tools/types/tools_get_response.rb index 63e816e..a4aa773 100644 --- a/lib/vapi_server_sdk/tools/types/tools_get_response.rb +++ b/lib/vapi_server_sdk/tools/types/tools_get_response.rb @@ -8,6 +8,9 @@ require_relative "../../types/make_tool" require_relative "../../types/transfer_call_tool" require_relative "../../types/output_tool" +require_relative "../../types/bash_tool" +require_relative "../../types/computer_tool" +require_relative "../../types/text_editor_tool" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::TransferCallTool.from_json(json_object: json_object) when "output" Vapi::OutputTool.from_json(json_object: json_object) + when "bash" + Vapi::BashTool.from_json(json_object: json_object) + when "computer" + Vapi::ComputerTool.from_json(json_object: json_object) + when "textEditor" + Vapi::TextEditorTool.from_json(json_object: json_object) else Vapi::DtmfTool.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::TransferCallTool.validate_raw(obj: obj) when "output" Vapi::OutputTool.validate_raw(obj: obj) + when "bash" + Vapi::BashTool.validate_raw(obj: obj) + when "computer" + Vapi::ComputerTool.validate_raw(obj: obj) + when "textEditor" + Vapi::TextEditorTool.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::BashTool] + # @return [Vapi::Tools::ToolsGetResponse] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::ComputerTool] + # @return [Vapi::Tools::ToolsGetResponse] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::TextEditorTool] + # @return [Vapi::Tools::ToolsGetResponse] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/tools/types/tools_list_response_item.rb b/lib/vapi_server_sdk/tools/types/tools_list_response_item.rb index c5dd1bb..33c2c09 100644 --- a/lib/vapi_server_sdk/tools/types/tools_list_response_item.rb +++ b/lib/vapi_server_sdk/tools/types/tools_list_response_item.rb @@ -8,6 +8,9 @@ require_relative "../../types/make_tool" require_relative "../../types/transfer_call_tool" require_relative "../../types/output_tool" +require_relative "../../types/bash_tool" +require_relative "../../types/computer_tool" +require_relative "../../types/text_editor_tool" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::TransferCallTool.from_json(json_object: json_object) when "output" Vapi::OutputTool.from_json(json_object: json_object) + when "bash" + Vapi::BashTool.from_json(json_object: json_object) + when "computer" + Vapi::ComputerTool.from_json(json_object: json_object) + when "textEditor" + Vapi::TextEditorTool.from_json(json_object: json_object) else Vapi::DtmfTool.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::TransferCallTool.validate_raw(obj: obj) when "output" Vapi::OutputTool.validate_raw(obj: obj) + when "bash" + Vapi::BashTool.validate_raw(obj: obj) + when "computer" + Vapi::ComputerTool.validate_raw(obj: obj) + when "textEditor" + Vapi::TextEditorTool.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::BashTool] + # @return [Vapi::Tools::ToolsListResponseItem] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::ComputerTool] + # @return [Vapi::Tools::ToolsListResponseItem] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::TextEditorTool] + # @return [Vapi::Tools::ToolsListResponseItem] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/tools/types/tools_update_response.rb b/lib/vapi_server_sdk/tools/types/tools_update_response.rb index 44f6d03..55fac4c 100644 --- a/lib/vapi_server_sdk/tools/types/tools_update_response.rb +++ b/lib/vapi_server_sdk/tools/types/tools_update_response.rb @@ -8,6 +8,9 @@ require_relative "../../types/make_tool" require_relative "../../types/transfer_call_tool" require_relative "../../types/output_tool" +require_relative "../../types/bash_tool" +require_relative "../../types/computer_tool" +require_relative "../../types/text_editor_tool" module Vapi class Tools @@ -49,6 +52,12 @@ def self.from_json(json_object:) Vapi::TransferCallTool.from_json(json_object: json_object) when "output" Vapi::OutputTool.from_json(json_object: json_object) + when "bash" + Vapi::BashTool.from_json(json_object: json_object) + when "computer" + Vapi::ComputerTool.from_json(json_object: json_object) + when "textEditor" + Vapi::TextEditorTool.from_json(json_object: json_object) else Vapi::DtmfTool.from_json(json_object: json_object) end @@ -74,6 +83,12 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "output" { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -102,6 +117,12 @@ def self.validate_raw(obj:) Vapi::TransferCallTool.validate_raw(obj: obj) when "output" Vapi::OutputTool.validate_raw(obj: obj) + when "bash" + Vapi::BashTool.validate_raw(obj: obj) + when "computer" + Vapi::ComputerTool.validate_raw(obj: obj) + when "textEditor" + Vapi::TextEditorTool.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -156,6 +177,24 @@ def self.transfer_call(member:) def self.output(member:) new(member: member, discriminant: "output") end + + # @param member [Vapi::BashTool] + # @return [Vapi::Tools::ToolsUpdateResponse] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::ComputerTool] + # @return [Vapi::Tools::ToolsUpdateResponse] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::TextEditorTool] + # @return [Vapi::Tools::ToolsUpdateResponse] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end end end end diff --git a/lib/vapi_server_sdk/types/analytics_query_dto.rb b/lib/vapi_server_sdk/types/analytics_query_dto.rb new file mode 100644 index 0000000..646f3ec --- /dev/null +++ b/lib/vapi_server_sdk/types/analytics_query_dto.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require_relative "analytics_query" +require "ostruct" +require "json" + +module Vapi + class AnalyticsQueryDto + # @return [Array] This is the list of metric queries you want to perform. + attr_reader :queries + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param queries [Array] This is the list of metric queries you want to perform. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AnalyticsQueryDto] + def initialize(queries:, additional_properties: nil) + @queries = queries + @additional_properties = additional_properties + @_field_set = { "queries": queries } + end + + # Deserialize a JSON object to an instance of AnalyticsQueryDto + # + # @param json_object [String] + # @return [Vapi::AnalyticsQueryDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + queries = parsed_json["queries"]&.map do |item| + item = item.to_json + Vapi::AnalyticsQuery.from_json(json_object: item) + end + new(queries: queries, additional_properties: struct) + end + + # Serialize an instance of AnalyticsQueryDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.queries.is_a?(Array) != false || raise("Passed value for field obj.queries is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/anthropic_credential.rb b/lib/vapi_server_sdk/types/anthropic_credential.rb index bead1d4..7fcacd4 100644 --- a/lib/vapi_server_sdk/types/anthropic_credential.rb +++ b/lib/vapi_server_sdk/types/anthropic_credential.rb @@ -18,6 +18,8 @@ class AnthropicCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class AnthropicCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AnthropicCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of AnthropicCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/anthropic_model.rb b/lib/vapi_server_sdk/types/anthropic_model.rb index 2ba0520..e8030a2 100644 --- a/lib/vapi_server_sdk/types/anthropic_model.rb +++ b/lib/vapi_server_sdk/types/anthropic_model.rb @@ -2,8 +2,8 @@ require_relative "open_ai_message" require_relative "anthropic_model_tools_item" +require_relative "create_custom_knowledge_base_dto" require_relative "anthropic_model_model" -require_relative "knowledge_base" require "ostruct" require "json" @@ -19,13 +19,15 @@ class AnthropicModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [Vapi::AnthropicModelModel] This is the Anthropic/Claude models that will be used. attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -56,10 +58,11 @@ class AnthropicModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [Vapi::AnthropicModelModel] This is the Anthropic/Claude models that will be used. # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -74,14 +77,15 @@ class AnthropicModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AnthropicModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -90,9 +94,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -117,14 +122,15 @@ def self.from_json(json_object:) Vapi::AnthropicModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -132,9 +138,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -159,9 +166,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(Vapi::AnthropicModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/anthropic_model_model.rb b/lib/vapi_server_sdk/types/anthropic_model_model.rb index e762819..d0f7f31 100644 --- a/lib/vapi_server_sdk/types/anthropic_model_model.rb +++ b/lib/vapi_server_sdk/types/anthropic_model_model.rb @@ -7,5 +7,7 @@ class AnthropicModelModel CLAUDE_3_SONNET_20240229 = "claude-3-sonnet-20240229" CLAUDE_3_HAIKU_20240307 = "claude-3-haiku-20240307" CLAUDE_35_SONNET_20240620 = "claude-3-5-sonnet-20240620" + CLAUDE_35_SONNET_20241022 = "claude-3-5-sonnet-20241022" + CLAUDE_35_HAIKU_20241022 = "claude-3-5-haiku-20241022" end end diff --git a/lib/vapi_server_sdk/types/anyscale_credential.rb b/lib/vapi_server_sdk/types/anyscale_credential.rb index 4d5f72b..9089124 100644 --- a/lib/vapi_server_sdk/types/anyscale_credential.rb +++ b/lib/vapi_server_sdk/types/anyscale_credential.rb @@ -18,6 +18,8 @@ class AnyscaleCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class AnyscaleCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AnyscaleCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of AnyscaleCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/anyscale_model.rb b/lib/vapi_server_sdk/types/anyscale_model.rb index 13828c9..1d6ddc3 100644 --- a/lib/vapi_server_sdk/types/anyscale_model.rb +++ b/lib/vapi_server_sdk/types/anyscale_model.rb @@ -2,7 +2,7 @@ require_relative "open_ai_message" require_relative "anyscale_model_tools_item" -require_relative "knowledge_base" +require_relative "create_custom_knowledge_base_dto" require "ostruct" require "json" @@ -18,13 +18,15 @@ class AnyscaleModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -55,10 +57,11 @@ class AnyscaleModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -73,14 +76,15 @@ class AnyscaleModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AnyscaleModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -89,9 +93,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -116,14 +121,15 @@ def self.from_json(json_object:) Vapi::AnyscaleModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -131,9 +137,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -158,9 +165,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/assembly_ai_credential.rb b/lib/vapi_server_sdk/types/assembly_ai_credential.rb new file mode 100644 index 0000000..61a18b0 --- /dev/null +++ b/lib/vapi_server_sdk/types/assembly_ai_credential.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class AssemblyAiCredential + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AssemblyAiCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AssemblyAiCredential + # + # @param json_object [String] + # @return [Vapi::AssemblyAiCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of AssemblyAiCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/assembly_ai_transcriber.rb b/lib/vapi_server_sdk/types/assembly_ai_transcriber.rb new file mode 100644 index 0000000..d0e4edb --- /dev/null +++ b/lib/vapi_server_sdk/types/assembly_ai_transcriber.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class AssemblyAiTranscriber + # @return [String] This is the language that will be set for the transcription. + attr_reader :language + # @return [String] The WebSocket URL that the transcriber connects to. + attr_reader :realtime_url + # @return [Array] Add up to 2500 characters of custom vocabulary. + attr_reader :word_boost + # @return [Float] The duration of the end utterance silence threshold in milliseconds. + attr_reader :end_utterance_silence_threshold + # @return [Boolean] Disable partial transcripts. + # Set to `true` to not receive partial transcripts. Defaults to `false`. + attr_reader :disable_partial_transcripts + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param language [String] This is the language that will be set for the transcription. + # @param realtime_url [String] The WebSocket URL that the transcriber connects to. + # @param word_boost [Array] Add up to 2500 characters of custom vocabulary. + # @param end_utterance_silence_threshold [Float] The duration of the end utterance silence threshold in milliseconds. + # @param disable_partial_transcripts [Boolean] Disable partial transcripts. + # Set to `true` to not receive partial transcripts. Defaults to `false`. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AssemblyAiTranscriber] + def initialize(language: OMIT, realtime_url: OMIT, word_boost: OMIT, end_utterance_silence_threshold: OMIT, + disable_partial_transcripts: OMIT, additional_properties: nil) + @language = language if language != OMIT + @realtime_url = realtime_url if realtime_url != OMIT + @word_boost = word_boost if word_boost != OMIT + @end_utterance_silence_threshold = end_utterance_silence_threshold if end_utterance_silence_threshold != OMIT + @disable_partial_transcripts = disable_partial_transcripts if disable_partial_transcripts != OMIT + @additional_properties = additional_properties + @_field_set = { + "language": language, + "realtimeUrl": realtime_url, + "wordBoost": word_boost, + "endUtteranceSilenceThreshold": end_utterance_silence_threshold, + "disablePartialTranscripts": disable_partial_transcripts + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AssemblyAiTranscriber + # + # @param json_object [String] + # @return [Vapi::AssemblyAiTranscriber] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + language = parsed_json["language"] + realtime_url = parsed_json["realtimeUrl"] + word_boost = parsed_json["wordBoost"] + end_utterance_silence_threshold = parsed_json["endUtteranceSilenceThreshold"] + disable_partial_transcripts = parsed_json["disablePartialTranscripts"] + new( + language: language, + realtime_url: realtime_url, + word_boost: word_boost, + end_utterance_silence_threshold: end_utterance_silence_threshold, + disable_partial_transcripts: disable_partial_transcripts, + additional_properties: struct + ) + end + + # Serialize an instance of AssemblyAiTranscriber to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.realtime_url&.is_a?(String) != false || raise("Passed value for field obj.realtime_url is not the expected type, validation failed.") + obj.word_boost&.is_a?(Array) != false || raise("Passed value for field obj.word_boost is not the expected type, validation failed.") + obj.end_utterance_silence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.end_utterance_silence_threshold is not the expected type, validation failed.") + obj.disable_partial_transcripts&.is_a?(Boolean) != false || raise("Passed value for field obj.disable_partial_transcripts is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/assistant.rb b/lib/vapi_server_sdk/types/assistant.rb index de09b7a..ff25823 100644 --- a/lib/vapi_server_sdk/types/assistant.rb +++ b/lib/vapi_server_sdk/types/assistant.rb @@ -15,6 +15,7 @@ require_relative "start_speaking_plan" require_relative "stop_speaking_plan" require_relative "monitor_plan" +require_relative "server" require "date" require "ostruct" require "json" @@ -27,6 +28,11 @@ class Assistant attr_reader :model # @return [Vapi::AssistantVoice] These are the options for the assistant's voice. attr_reader :voice + # @return [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. + attr_reader :first_message # @return [Vapi::AssistantFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -43,7 +49,7 @@ class Assistant # store on your server. Defaults to false. attr_reader :hipaa_enabled # @return [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. attr_reader :client_messages # @return [Array] These are the messages that will be sent to your Server URL. Default is @@ -60,11 +66,6 @@ class Assistant # @return [Vapi::AssistantBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. attr_reader :background_sound - # @return [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false - attr_reader :backchanneling_enabled # @return [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -82,11 +83,6 @@ class Assistant # @return [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. attr_reader :name - # @return [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. - attr_reader :first_message # @return [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -107,18 +103,6 @@ class Assistant attr_reader :end_call_phrases # @return [Hash{String => Object}] This is for metadata you want to store on the assistant. attr_reader :metadata - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret # @return [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. attr_reader :analysis_plan # @return [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in @@ -164,6 +148,13 @@ class Assistant # all the credentials are available for use in the call but you can provide a # subset using this. attr_reader :credential_ids + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl + attr_reader :server # @return [String] This is the unique identifier for the assistant. attr_reader :id # @return [String] This is the unique identifier for the org that this assistant belongs to. @@ -183,6 +174,10 @@ class Assistant # @param transcriber [Vapi::AssistantTranscriber] These are the options for the assistant's transcriber. # @param model [Vapi::AssistantModel] These are the options for the assistant's LLM. # @param voice [Vapi::AssistantVoice] These are the options for the assistant's voice. + # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. # @param first_message_mode [Vapi::AssistantFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -197,7 +192,7 @@ class Assistant # the end of the call, you will still receive an end-of-call-report message to # store on your server. Defaults to false. # @param client_messages [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. # @param server_messages [Array] These are the messages that will be sent to your Server URL. Default is # h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. @@ -209,10 +204,6 @@ class Assistant # @default 600 (10 minutes) # @param background_sound [Vapi::AssistantBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. - # @param backchanneling_enabled [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false # @param background_denoising_enabled [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -226,10 +217,6 @@ class Assistant # call transport provider is used. # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. - # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. # @param voicemail_detection [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -245,16 +232,6 @@ class Assistant # @param end_call_phrases [Array] This list contains phrases that, if spoken by the assistant, will trigger the # call to be hung up. Case insensitive. # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. # @param analysis_plan [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. # @param artifact_plan [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in # `call.artifact`. @@ -293,17 +270,24 @@ class Assistant # @param credential_ids [Array] These are the credentials that will be used for the assistant calls. By default, # all the credentials are available for use in the call but you can provide a # subset using this. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl # @param id [String] This is the unique identifier for the assistant. # @param org_id [String] This is the unique identifier for the org that this assistant belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the assistant was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Assistant] - def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: OMIT, hipaa_enabled: OMIT, - client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, backchanneling_enabled: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, first_message: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, server_url: OMIT, server_url_secret: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, additional_properties: nil) + def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT + @first_message = first_message if first_message != OMIT @first_message_mode = first_message_mode if first_message_mode != OMIT @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @client_messages = client_messages if client_messages != OMIT @@ -311,19 +295,15 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: @silence_timeout_seconds = silence_timeout_seconds if silence_timeout_seconds != OMIT @max_duration_seconds = max_duration_seconds if max_duration_seconds != OMIT @background_sound = background_sound if background_sound != OMIT - @backchanneling_enabled = backchanneling_enabled if backchanneling_enabled != OMIT @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT @name = name if name != OMIT - @first_message = first_message if first_message != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @voicemail_message = voicemail_message if voicemail_message != OMIT @end_call_message = end_call_message if end_call_message != OMIT @end_call_phrases = end_call_phrases if end_call_phrases != OMIT @metadata = metadata if metadata != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT @analysis_plan = analysis_plan if analysis_plan != OMIT @artifact_plan = artifact_plan if artifact_plan != OMIT @message_plan = message_plan if message_plan != OMIT @@ -331,6 +311,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: @stop_speaking_plan = stop_speaking_plan if stop_speaking_plan != OMIT @monitor_plan = monitor_plan if monitor_plan != OMIT @credential_ids = credential_ids if credential_ids != OMIT + @server = server if server != OMIT @id = id @org_id = org_id @created_at = created_at @@ -340,6 +321,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: "transcriber": transcriber, "model": model, "voice": voice, + "firstMessage": first_message, "firstMessageMode": first_message_mode, "hipaaEnabled": hipaa_enabled, "clientMessages": client_messages, @@ -347,19 +329,15 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: "silenceTimeoutSeconds": silence_timeout_seconds, "maxDurationSeconds": max_duration_seconds, "backgroundSound": background_sound, - "backchannelingEnabled": backchanneling_enabled, "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, "name": name, - "firstMessage": first_message, "voicemailDetection": voicemail_detection, "voicemailMessage": voicemail_message, "endCallMessage": end_call_message, "endCallPhrases": end_call_phrases, "metadata": metadata, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, "analysisPlan": analysis_plan, "artifactPlan": artifact_plan, "messagePlan": message_plan, @@ -367,6 +345,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: "stopSpeakingPlan": stop_speaking_plan, "monitorPlan": monitor_plan, "credentialIds": credential_ids, + "server": server, "id": id, "orgId": org_id, "createdAt": created_at, @@ -401,6 +380,7 @@ def self.from_json(json_object:) voice = parsed_json["voice"].to_json voice = Vapi::AssistantVoice.from_json(json_object: voice) end + first_message = parsed_json["firstMessage"] first_message_mode = parsed_json["firstMessageMode"] hipaa_enabled = parsed_json["hipaaEnabled"] client_messages = parsed_json["clientMessages"] @@ -408,7 +388,6 @@ def self.from_json(json_object:) silence_timeout_seconds = parsed_json["silenceTimeoutSeconds"] max_duration_seconds = parsed_json["maxDurationSeconds"] background_sound = parsed_json["backgroundSound"] - backchanneling_enabled = parsed_json["backchannelingEnabled"] background_denoising_enabled = parsed_json["backgroundDenoisingEnabled"] model_output_in_messages_enabled = parsed_json["modelOutputInMessagesEnabled"] transport_configurations = parsed_json["transportConfigurations"]&.map do |item| @@ -416,7 +395,6 @@ def self.from_json(json_object:) Vapi::TransportConfigurationTwilio.from_json(json_object: item) end name = parsed_json["name"] - first_message = parsed_json["firstMessage"] if parsed_json["voicemailDetection"].nil? voicemail_detection = nil else @@ -427,8 +405,6 @@ def self.from_json(json_object:) end_call_message = parsed_json["endCallMessage"] end_call_phrases = parsed_json["endCallPhrases"] metadata = parsed_json["metadata"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] if parsed_json["analysisPlan"].nil? analysis_plan = nil else @@ -466,6 +442,12 @@ def self.from_json(json_object:) monitor_plan = Vapi::MonitorPlan.from_json(json_object: monitor_plan) end credential_ids = parsed_json["credentialIds"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) @@ -474,6 +456,7 @@ def self.from_json(json_object:) transcriber: transcriber, model: model, voice: voice, + first_message: first_message, first_message_mode: first_message_mode, hipaa_enabled: hipaa_enabled, client_messages: client_messages, @@ -481,19 +464,15 @@ def self.from_json(json_object:) silence_timeout_seconds: silence_timeout_seconds, max_duration_seconds: max_duration_seconds, background_sound: background_sound, - backchanneling_enabled: backchanneling_enabled, background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, name: name, - first_message: first_message, voicemail_detection: voicemail_detection, voicemail_message: voicemail_message, end_call_message: end_call_message, end_call_phrases: end_call_phrases, metadata: metadata, - server_url: server_url, - server_url_secret: server_url_secret, analysis_plan: analysis_plan, artifact_plan: artifact_plan, message_plan: message_plan, @@ -501,6 +480,7 @@ def self.from_json(json_object:) stop_speaking_plan: stop_speaking_plan, monitor_plan: monitor_plan, credential_ids: credential_ids, + server: server, id: id, org_id: org_id, created_at: created_at, @@ -526,6 +506,7 @@ def self.validate_raw(obj:) obj.transcriber.nil? || Vapi::AssistantTranscriber.validate_raw(obj: obj.transcriber) obj.model.nil? || Vapi::AssistantModel.validate_raw(obj: obj.model) obj.voice.nil? || Vapi::AssistantVoice.validate_raw(obj: obj.voice) + obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.first_message_mode&.is_a?(Vapi::AssistantFirstMessageMode) != false || raise("Passed value for field obj.first_message_mode is not the expected type, validation failed.") obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") obj.client_messages&.is_a?(Array) != false || raise("Passed value for field obj.client_messages is not the expected type, validation failed.") @@ -533,19 +514,15 @@ def self.validate_raw(obj:) obj.silence_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.silence_timeout_seconds is not the expected type, validation failed.") obj.max_duration_seconds&.is_a?(Float) != false || raise("Passed value for field obj.max_duration_seconds is not the expected type, validation failed.") obj.background_sound&.is_a?(Vapi::AssistantBackgroundSound) != false || raise("Passed value for field obj.background_sound is not the expected type, validation failed.") - obj.backchanneling_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.backchanneling_enabled is not the expected type, validation failed.") obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") - obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.") obj.end_call_message&.is_a?(String) != false || raise("Passed value for field obj.end_call_message is not the expected type, validation failed.") obj.end_call_phrases&.is_a?(Array) != false || raise("Passed value for field obj.end_call_phrases is not the expected type, validation failed.") obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") obj.analysis_plan.nil? || Vapi::AnalysisPlan.validate_raw(obj: obj.analysis_plan) obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan) obj.message_plan.nil? || Vapi::MessagePlan.validate_raw(obj: obj.message_plan) @@ -553,6 +530,7 @@ def self.validate_raw(obj:) obj.stop_speaking_plan.nil? || Vapi::StopSpeakingPlan.validate_raw(obj: obj.stop_speaking_plan) obj.monitor_plan.nil? || Vapi::MonitorPlan.validate_raw(obj: obj.monitor_plan) obj.credential_ids&.is_a?(Array) != false || raise("Passed value for field obj.credential_ids is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/assistant_client_messages_item.rb b/lib/vapi_server_sdk/types/assistant_client_messages_item.rb index 3d2bfbf..f1e36ea 100644 --- a/lib/vapi_server_sdk/types/assistant_client_messages_item.rb +++ b/lib/vapi_server_sdk/types/assistant_client_messages_item.rb @@ -14,6 +14,7 @@ class AssistantClientMessagesItem TRANSCRIPT = "transcript" TOOL_CALLS = "tool-calls" TOOL_CALLS_RESULT = "tool-calls-result" + TRANSFER_UPDATE = "transfer-update" USER_INTERRUPTED = "user-interrupted" VOICE_INPUT = "voice-input" end diff --git a/lib/vapi_server_sdk/types/assistant_custom_endpointing_rule.rb b/lib/vapi_server_sdk/types/assistant_custom_endpointing_rule.rb new file mode 100644 index 0000000..65adca5 --- /dev/null +++ b/lib/vapi_server_sdk/types/assistant_custom_endpointing_rule.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +require_relative "regex_option" +require "ostruct" +require "json" + +module Vapi + class AssistantCustomEndpointingRule + # @return [String] This is the regex pattern to match. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + attr_reader :regex + # @return [Array] These are the options for the regex match. Defaults to all disabled. + # @default [] + attr_reader :regex_options + # @return [Float] This is the endpointing timeout in seconds, if the rule is matched. + attr_reader :timeout_seconds + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param regex [String] This is the regex pattern to match. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + # @param regex_options [Array] These are the options for the regex match. Defaults to all disabled. + # @default [] + # @param timeout_seconds [Float] This is the endpointing timeout in seconds, if the rule is matched. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AssistantCustomEndpointingRule] + def initialize(regex:, timeout_seconds:, regex_options: OMIT, additional_properties: nil) + @regex = regex + @regex_options = regex_options if regex_options != OMIT + @timeout_seconds = timeout_seconds + @additional_properties = additional_properties + @_field_set = { + "regex": regex, + "regexOptions": regex_options, + "timeoutSeconds": timeout_seconds + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AssistantCustomEndpointingRule + # + # @param json_object [String] + # @return [Vapi::AssistantCustomEndpointingRule] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + regex = parsed_json["regex"] + regex_options = parsed_json["regexOptions"]&.map do |item| + item = item.to_json + Vapi::RegexOption.from_json(json_object: item) + end + timeout_seconds = parsed_json["timeoutSeconds"] + new( + regex: regex, + regex_options: regex_options, + timeout_seconds: timeout_seconds, + additional_properties: struct + ) + end + + # Serialize an instance of AssistantCustomEndpointingRule to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.regex.is_a?(String) != false || raise("Passed value for field obj.regex is not the expected type, validation failed.") + obj.regex_options&.is_a?(Array) != false || raise("Passed value for field obj.regex_options is not the expected type, validation failed.") + obj.timeout_seconds.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/assistant_model.rb b/lib/vapi_server_sdk/types/assistant_model.rb index 88a3053..8c611f9 100644 --- a/lib/vapi_server_sdk/types/assistant_model.rb +++ b/lib/vapi_server_sdk/types/assistant_model.rb @@ -5,12 +5,15 @@ require_relative "anthropic_model" require_relative "custom_llm_model" require_relative "deep_infra_model" +require_relative "google_model" require_relative "groq_model" +require_relative "inflection_ai_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" require_relative "together_ai_model" require_relative "vapi_model" +require_relative "xai_model" module Vapi # These are the options for the assistant's LLM. @@ -46,8 +49,12 @@ def self.from_json(json_object:) Vapi::CustomLlmModel.from_json(json_object: json_object) when "deepinfra" Vapi::DeepInfraModel.from_json(json_object: json_object) + when "google" + Vapi::GoogleModel.from_json(json_object: json_object) when "groq" Vapi::GroqModel.from_json(json_object: json_object) + when "inflection-ai" + Vapi::InflectionAiModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -58,6 +65,8 @@ def self.from_json(json_object:) Vapi::TogetherAiModel.from_json(json_object: json_object) when "vapi" Vapi::VapiModel.from_json(json_object: json_object) + when "xai" + Vapi::XaiModel.from_json(json_object: json_object) else Vapi::AnyscaleModel.from_json(json_object: json_object) end @@ -77,8 +86,12 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "deepinfra" { **@member.to_json, provider: @discriminant }.to_json + when "google" + { **@member.to_json, provider: @discriminant }.to_json when "groq" { **@member.to_json, provider: @discriminant }.to_json + when "inflection-ai" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -89,6 +102,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "vapi" { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -111,8 +126,12 @@ def self.validate_raw(obj:) Vapi::CustomLlmModel.validate_raw(obj: obj) when "deepinfra" Vapi::DeepInfraModel.validate_raw(obj: obj) + when "google" + Vapi::GoogleModel.validate_raw(obj: obj) when "groq" Vapi::GroqModel.validate_raw(obj: obj) + when "inflection-ai" + Vapi::InflectionAiModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -123,6 +142,8 @@ def self.validate_raw(obj:) Vapi::TogetherAiModel.validate_raw(obj: obj) when "vapi" Vapi::VapiModel.validate_raw(obj: obj) + when "xai" + Vapi::XaiModel.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -160,12 +181,24 @@ def self.deepinfra(member:) new(member: member, discriminant: "deepinfra") end + # @param member [Vapi::GoogleModel] + # @return [Vapi::AssistantModel] + def self.google(member:) + new(member: member, discriminant: "google") + end + # @param member [Vapi::GroqModel] # @return [Vapi::AssistantModel] def self.groq(member:) new(member: member, discriminant: "groq") end + # @param member [Vapi::InflectionAiModel] + # @return [Vapi::AssistantModel] + def self.inflection_ai(member:) + new(member: member, discriminant: "inflection-ai") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::AssistantModel] def self.openai(member:) @@ -195,5 +228,11 @@ def self.together_ai(member:) def self.vapi(member:) new(member: member, discriminant: "vapi") end + + # @param member [Vapi::XaiModel] + # @return [Vapi::AssistantModel] + def self.xai(member:) + new(member: member, discriminant: "xai") + end end end diff --git a/lib/vapi_server_sdk/types/assistant_overrides.rb b/lib/vapi_server_sdk/types/assistant_overrides.rb index f3234fe..e2fec5f 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides.rb @@ -15,6 +15,7 @@ require_relative "start_speaking_plan" require_relative "stop_speaking_plan" require_relative "monitor_plan" +require_relative "server" require "ostruct" require "json" @@ -26,6 +27,11 @@ class AssistantOverrides attr_reader :model # @return [Vapi::AssistantOverridesVoice] These are the options for the assistant's voice. attr_reader :voice + # @return [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. + attr_reader :first_message # @return [Vapi::AssistantOverridesFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -42,7 +48,7 @@ class AssistantOverrides # store on your server. Defaults to false. attr_reader :hipaa_enabled # @return [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. attr_reader :client_messages # @return [Array] These are the messages that will be sent to your Server URL. Default is @@ -59,11 +65,6 @@ class AssistantOverrides # @return [Vapi::AssistantOverridesBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. attr_reader :background_sound - # @return [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false - attr_reader :backchanneling_enabled # @return [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -80,15 +81,17 @@ class AssistantOverrides attr_reader :transport_configurations # @return [Hash{String => Object}] These are values that will be used to replace the template variables in the # assistant messages and other text-based fields. + # This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html + # So for example, `{{ name }}` will be replaced with the value of `name` in + # `variableValues`. + # `{{"now" | date: "%b %d, %Y, %I:%M %p", "America/New_York"}}` will be replaced + # with the current date and time in New York. + # Some VAPI reserved defaults: + # - *customer* - the customer object attr_reader :variable_values # @return [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. attr_reader :name - # @return [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. - attr_reader :first_message # @return [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -109,18 +112,6 @@ class AssistantOverrides attr_reader :end_call_phrases # @return [Hash{String => Object}] This is for metadata you want to store on the assistant. attr_reader :metadata - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret # @return [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. attr_reader :analysis_plan # @return [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in @@ -166,6 +157,13 @@ class AssistantOverrides # all the credentials are available for use in the call but you can provide a # subset using this. attr_reader :credential_ids + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -177,6 +175,10 @@ class AssistantOverrides # @param transcriber [Vapi::AssistantOverridesTranscriber] These are the options for the assistant's transcriber. # @param model [Vapi::AssistantOverridesModel] These are the options for the assistant's LLM. # @param voice [Vapi::AssistantOverridesVoice] These are the options for the assistant's voice. + # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. # @param first_message_mode [Vapi::AssistantOverridesFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -191,7 +193,7 @@ class AssistantOverrides # the end of the call, you will still receive an end-of-call-report message to # store on your server. Defaults to false. # @param client_messages [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. # @param server_messages [Array] These are the messages that will be sent to your Server URL. Default is # h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. @@ -203,10 +205,6 @@ class AssistantOverrides # @default 600 (10 minutes) # @param background_sound [Vapi::AssistantOverridesBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. - # @param backchanneling_enabled [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false # @param background_denoising_enabled [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -220,12 +218,15 @@ class AssistantOverrides # call transport provider is used. # @param variable_values [Hash{String => Object}] These are values that will be used to replace the template variables in the # assistant messages and other text-based fields. + # This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html + # So for example, `{{ name }}` will be replaced with the value of `name` in + # `variableValues`. + # `{{"now" | date: "%b %d, %Y, %I:%M %p", "America/New_York"}}` will be replaced + # with the current date and time in New York. + # Some VAPI reserved defaults: + # - *customer* - the customer object # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. - # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. # @param voicemail_detection [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -241,16 +242,6 @@ class AssistantOverrides # @param end_call_phrases [Array] This list contains phrases that, if spoken by the assistant, will trigger the # call to be hung up. Case insensitive. # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. # @param analysis_plan [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. # @param artifact_plan [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in # `call.artifact`. @@ -289,13 +280,20 @@ class AssistantOverrides # @param credential_ids [Array] These are the credentials that will be used for the assistant calls. By default, # all the credentials are available for use in the call but you can provide a # subset using this. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AssistantOverrides] - def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: OMIT, hipaa_enabled: OMIT, - client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, backchanneling_enabled: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, variable_values: OMIT, name: OMIT, first_message: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, server_url: OMIT, server_url_secret: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, additional_properties: nil) + def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, variable_values: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT + @first_message = first_message if first_message != OMIT @first_message_mode = first_message_mode if first_message_mode != OMIT @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @client_messages = client_messages if client_messages != OMIT @@ -303,20 +301,16 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: @silence_timeout_seconds = silence_timeout_seconds if silence_timeout_seconds != OMIT @max_duration_seconds = max_duration_seconds if max_duration_seconds != OMIT @background_sound = background_sound if background_sound != OMIT - @backchanneling_enabled = backchanneling_enabled if backchanneling_enabled != OMIT @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT @variable_values = variable_values if variable_values != OMIT @name = name if name != OMIT - @first_message = first_message if first_message != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @voicemail_message = voicemail_message if voicemail_message != OMIT @end_call_message = end_call_message if end_call_message != OMIT @end_call_phrases = end_call_phrases if end_call_phrases != OMIT @metadata = metadata if metadata != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT @analysis_plan = analysis_plan if analysis_plan != OMIT @artifact_plan = artifact_plan if artifact_plan != OMIT @message_plan = message_plan if message_plan != OMIT @@ -324,11 +318,13 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: @stop_speaking_plan = stop_speaking_plan if stop_speaking_plan != OMIT @monitor_plan = monitor_plan if monitor_plan != OMIT @credential_ids = credential_ids if credential_ids != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "transcriber": transcriber, "model": model, "voice": voice, + "firstMessage": first_message, "firstMessageMode": first_message_mode, "hipaaEnabled": hipaa_enabled, "clientMessages": client_messages, @@ -336,27 +332,24 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: "silenceTimeoutSeconds": silence_timeout_seconds, "maxDurationSeconds": max_duration_seconds, "backgroundSound": background_sound, - "backchannelingEnabled": backchanneling_enabled, "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, "variableValues": variable_values, "name": name, - "firstMessage": first_message, "voicemailDetection": voicemail_detection, "voicemailMessage": voicemail_message, "endCallMessage": end_call_message, "endCallPhrases": end_call_phrases, "metadata": metadata, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, "analysisPlan": analysis_plan, "artifactPlan": artifact_plan, "messagePlan": message_plan, "startSpeakingPlan": start_speaking_plan, "stopSpeakingPlan": stop_speaking_plan, "monitorPlan": monitor_plan, - "credentialIds": credential_ids + "credentialIds": credential_ids, + "server": server }.reject do |_k, v| v == OMIT end @@ -387,6 +380,7 @@ def self.from_json(json_object:) voice = parsed_json["voice"].to_json voice = Vapi::AssistantOverridesVoice.from_json(json_object: voice) end + first_message = parsed_json["firstMessage"] first_message_mode = parsed_json["firstMessageMode"] hipaa_enabled = parsed_json["hipaaEnabled"] client_messages = parsed_json["clientMessages"] @@ -394,7 +388,6 @@ def self.from_json(json_object:) silence_timeout_seconds = parsed_json["silenceTimeoutSeconds"] max_duration_seconds = parsed_json["maxDurationSeconds"] background_sound = parsed_json["backgroundSound"] - backchanneling_enabled = parsed_json["backchannelingEnabled"] background_denoising_enabled = parsed_json["backgroundDenoisingEnabled"] model_output_in_messages_enabled = parsed_json["modelOutputInMessagesEnabled"] transport_configurations = parsed_json["transportConfigurations"]&.map do |item| @@ -403,7 +396,6 @@ def self.from_json(json_object:) end variable_values = parsed_json["variableValues"] name = parsed_json["name"] - first_message = parsed_json["firstMessage"] if parsed_json["voicemailDetection"].nil? voicemail_detection = nil else @@ -414,8 +406,6 @@ def self.from_json(json_object:) end_call_message = parsed_json["endCallMessage"] end_call_phrases = parsed_json["endCallPhrases"] metadata = parsed_json["metadata"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] if parsed_json["analysisPlan"].nil? analysis_plan = nil else @@ -453,10 +443,17 @@ def self.from_json(json_object:) monitor_plan = Vapi::MonitorPlan.from_json(json_object: monitor_plan) end credential_ids = parsed_json["credentialIds"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( transcriber: transcriber, model: model, voice: voice, + first_message: first_message, first_message_mode: first_message_mode, hipaa_enabled: hipaa_enabled, client_messages: client_messages, @@ -464,20 +461,16 @@ def self.from_json(json_object:) silence_timeout_seconds: silence_timeout_seconds, max_duration_seconds: max_duration_seconds, background_sound: background_sound, - backchanneling_enabled: backchanneling_enabled, background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, variable_values: variable_values, name: name, - first_message: first_message, voicemail_detection: voicemail_detection, voicemail_message: voicemail_message, end_call_message: end_call_message, end_call_phrases: end_call_phrases, metadata: metadata, - server_url: server_url, - server_url_secret: server_url_secret, analysis_plan: analysis_plan, artifact_plan: artifact_plan, message_plan: message_plan, @@ -485,6 +478,7 @@ def self.from_json(json_object:) stop_speaking_plan: stop_speaking_plan, monitor_plan: monitor_plan, credential_ids: credential_ids, + server: server, additional_properties: struct ) end @@ -506,6 +500,7 @@ def self.validate_raw(obj:) obj.transcriber.nil? || Vapi::AssistantOverridesTranscriber.validate_raw(obj: obj.transcriber) obj.model.nil? || Vapi::AssistantOverridesModel.validate_raw(obj: obj.model) obj.voice.nil? || Vapi::AssistantOverridesVoice.validate_raw(obj: obj.voice) + obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.first_message_mode&.is_a?(Vapi::AssistantOverridesFirstMessageMode) != false || raise("Passed value for field obj.first_message_mode is not the expected type, validation failed.") obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") obj.client_messages&.is_a?(Array) != false || raise("Passed value for field obj.client_messages is not the expected type, validation failed.") @@ -513,20 +508,16 @@ def self.validate_raw(obj:) obj.silence_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.silence_timeout_seconds is not the expected type, validation failed.") obj.max_duration_seconds&.is_a?(Float) != false || raise("Passed value for field obj.max_duration_seconds is not the expected type, validation failed.") obj.background_sound&.is_a?(Vapi::AssistantOverridesBackgroundSound) != false || raise("Passed value for field obj.background_sound is not the expected type, validation failed.") - obj.backchanneling_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.backchanneling_enabled is not the expected type, validation failed.") obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") obj.variable_values&.is_a?(Hash) != false || raise("Passed value for field obj.variable_values is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") - obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.") obj.end_call_message&.is_a?(String) != false || raise("Passed value for field obj.end_call_message is not the expected type, validation failed.") obj.end_call_phrases&.is_a?(Array) != false || raise("Passed value for field obj.end_call_phrases is not the expected type, validation failed.") obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") obj.analysis_plan.nil? || Vapi::AnalysisPlan.validate_raw(obj: obj.analysis_plan) obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan) obj.message_plan.nil? || Vapi::MessagePlan.validate_raw(obj: obj.message_plan) @@ -534,6 +525,7 @@ def self.validate_raw(obj:) obj.stop_speaking_plan.nil? || Vapi::StopSpeakingPlan.validate_raw(obj: obj.stop_speaking_plan) obj.monitor_plan.nil? || Vapi::MonitorPlan.validate_raw(obj: obj.monitor_plan) obj.credential_ids&.is_a?(Array) != false || raise("Passed value for field obj.credential_ids is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/assistant_overrides_client_messages_item.rb b/lib/vapi_server_sdk/types/assistant_overrides_client_messages_item.rb index 71d5ce7..f06402e 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_client_messages_item.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_client_messages_item.rb @@ -14,6 +14,7 @@ class AssistantOverridesClientMessagesItem TRANSCRIPT = "transcript" TOOL_CALLS = "tool-calls" TOOL_CALLS_RESULT = "tool-calls-result" + TRANSFER_UPDATE = "transfer-update" USER_INTERRUPTED = "user-interrupted" VOICE_INPUT = "voice-input" end diff --git a/lib/vapi_server_sdk/types/assistant_overrides_model.rb b/lib/vapi_server_sdk/types/assistant_overrides_model.rb index 5d2e64f..f1afec0 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_model.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_model.rb @@ -5,12 +5,15 @@ require_relative "anthropic_model" require_relative "custom_llm_model" require_relative "deep_infra_model" +require_relative "google_model" require_relative "groq_model" +require_relative "inflection_ai_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" require_relative "together_ai_model" require_relative "vapi_model" +require_relative "xai_model" module Vapi # These are the options for the assistant's LLM. @@ -46,8 +49,12 @@ def self.from_json(json_object:) Vapi::CustomLlmModel.from_json(json_object: json_object) when "deepinfra" Vapi::DeepInfraModel.from_json(json_object: json_object) + when "google" + Vapi::GoogleModel.from_json(json_object: json_object) when "groq" Vapi::GroqModel.from_json(json_object: json_object) + when "inflection-ai" + Vapi::InflectionAiModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -58,6 +65,8 @@ def self.from_json(json_object:) Vapi::TogetherAiModel.from_json(json_object: json_object) when "vapi" Vapi::VapiModel.from_json(json_object: json_object) + when "xai" + Vapi::XaiModel.from_json(json_object: json_object) else Vapi::AnyscaleModel.from_json(json_object: json_object) end @@ -77,8 +86,12 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "deepinfra" { **@member.to_json, provider: @discriminant }.to_json + when "google" + { **@member.to_json, provider: @discriminant }.to_json when "groq" { **@member.to_json, provider: @discriminant }.to_json + when "inflection-ai" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -89,6 +102,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "vapi" { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -111,8 +126,12 @@ def self.validate_raw(obj:) Vapi::CustomLlmModel.validate_raw(obj: obj) when "deepinfra" Vapi::DeepInfraModel.validate_raw(obj: obj) + when "google" + Vapi::GoogleModel.validate_raw(obj: obj) when "groq" Vapi::GroqModel.validate_raw(obj: obj) + when "inflection-ai" + Vapi::InflectionAiModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -123,6 +142,8 @@ def self.validate_raw(obj:) Vapi::TogetherAiModel.validate_raw(obj: obj) when "vapi" Vapi::VapiModel.validate_raw(obj: obj) + when "xai" + Vapi::XaiModel.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -160,12 +181,24 @@ def self.deepinfra(member:) new(member: member, discriminant: "deepinfra") end + # @param member [Vapi::GoogleModel] + # @return [Vapi::AssistantOverridesModel] + def self.google(member:) + new(member: member, discriminant: "google") + end + # @param member [Vapi::GroqModel] # @return [Vapi::AssistantOverridesModel] def self.groq(member:) new(member: member, discriminant: "groq") end + # @param member [Vapi::InflectionAiModel] + # @return [Vapi::AssistantOverridesModel] + def self.inflection_ai(member:) + new(member: member, discriminant: "inflection-ai") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::AssistantOverridesModel] def self.openai(member:) @@ -195,5 +228,11 @@ def self.together_ai(member:) def self.vapi(member:) new(member: member, discriminant: "vapi") end + + # @param member [Vapi::XaiModel] + # @return [Vapi::AssistantOverridesModel] + def self.xai(member:) + new(member: member, discriminant: "xai") + end end end diff --git a/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb b/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb index 0bef217..426ea97 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb @@ -7,6 +7,7 @@ class AssistantOverridesServerMessagesItem FUNCTION_CALL = "function-call" HANG = "hang" LANGUAGE_CHANGED = "language-changed" + LANGUAGE_CHANGE_DETECTED = "language-change-detected" MODEL_OUTPUT = "model-output" PHONE_CALL_CONTROL = "phone-call-control" SPEECH_UPDATE = "speech-update" diff --git a/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb b/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb index 3955819..7ca038b 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require "json" +require_relative "assembly_ai_transcriber" +require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" require_relative "talkscriber_transcriber" @@ -31,6 +33,10 @@ def initialize(member:, discriminant:) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "custom-transcriber" + Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramTranscriber.from_json(json_object: json_object) when "gladia" @@ -38,7 +44,7 @@ def self.from_json(json_object:) when "talkscriber" Vapi::TalkscriberTranscriber.from_json(json_object: json_object) else - Vapi::DeepgramTranscriber.from_json(json_object: json_object) + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) end new(member: member, discriminant: struct.provider) end @@ -48,6 +54,10 @@ def self.from_json(json_object:) # @return [String] def to_json(*_args) case @discriminant + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-transcriber" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "gladia" @@ -68,6 +78,10 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) case obj.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "custom-transcriber" + Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramTranscriber.validate_raw(obj: obj) when "gladia" @@ -87,6 +101,18 @@ def is_a?(obj) @member.is_a?(obj) end + # @param member [Vapi::AssemblyAiTranscriber] + # @return [Vapi::AssistantOverridesTranscriber] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CustomTranscriber] + # @return [Vapi::AssistantOverridesTranscriber] + def self.custom_transcriber(member:) + new(member: member, discriminant: "custom-transcriber") + end + # @param member [Vapi::DeepgramTranscriber] # @return [Vapi::AssistantOverridesTranscriber] def self.deepgram(member:) diff --git a/lib/vapi_server_sdk/types/assistant_overrides_voice.rb b/lib/vapi_server_sdk/types/assistant_overrides_voice.rb index e63c558..52a71c1 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_voice.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_voice.rb @@ -3,6 +3,7 @@ require "json" require_relative "azure_voice" require_relative "cartesia_voice" +require_relative "custom_voice" require_relative "deepgram_voice" require_relative "eleven_labs_voice" require_relative "lmnt_voice" @@ -10,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "tavus_voice" module Vapi # These are the options for the assistant's voice. @@ -41,6 +43,8 @@ def self.from_json(json_object:) Vapi::AzureVoice.from_json(json_object: json_object) when "cartesia" Vapi::CartesiaVoice.from_json(json_object: json_object) + when "custom-voice" + Vapi::CustomVoice.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramVoice.from_json(json_object: json_object) when "11labs" @@ -55,6 +59,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "tavus" + Vapi::TavusVoice.from_json(json_object: json_object) else Vapi::AzureVoice.from_json(json_object: json_object) end @@ -70,6 +76,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "cartesia" { **@member.to_json, provider: @discriminant }.to_json + when "custom-voice" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "11labs" @@ -84,6 +92,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -102,6 +112,8 @@ def self.validate_raw(obj:) Vapi::AzureVoice.validate_raw(obj: obj) when "cartesia" Vapi::CartesiaVoice.validate_raw(obj: obj) + when "custom-voice" + Vapi::CustomVoice.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramVoice.validate_raw(obj: obj) when "11labs" @@ -116,6 +128,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "tavus" + Vapi::TavusVoice.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -141,6 +155,12 @@ def self.cartesia(member:) new(member: member, discriminant: "cartesia") end + # @param member [Vapi::CustomVoice] + # @return [Vapi::AssistantOverridesVoice] + def self.custom_voice(member:) + new(member: member, discriminant: "custom-voice") + end + # @param member [Vapi::DeepgramVoice] # @return [Vapi::AssistantOverridesVoice] def self.deepgram(member:) @@ -182,5 +202,11 @@ def self.playht(member:) def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + + # @param member [Vapi::TavusVoice] + # @return [Vapi::AssistantOverridesVoice] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end end end diff --git a/lib/vapi_server_sdk/types/assistant_server_messages_item.rb b/lib/vapi_server_sdk/types/assistant_server_messages_item.rb index 965b01f..fd68d1f 100644 --- a/lib/vapi_server_sdk/types/assistant_server_messages_item.rb +++ b/lib/vapi_server_sdk/types/assistant_server_messages_item.rb @@ -7,6 +7,7 @@ class AssistantServerMessagesItem FUNCTION_CALL = "function-call" HANG = "hang" LANGUAGE_CHANGED = "language-changed" + LANGUAGE_CHANGE_DETECTED = "language-change-detected" MODEL_OUTPUT = "model-output" PHONE_CALL_CONTROL = "phone-call-control" SPEECH_UPDATE = "speech-update" diff --git a/lib/vapi_server_sdk/types/assistant_transcriber.rb b/lib/vapi_server_sdk/types/assistant_transcriber.rb index 2ff78fc..af40540 100644 --- a/lib/vapi_server_sdk/types/assistant_transcriber.rb +++ b/lib/vapi_server_sdk/types/assistant_transcriber.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require "json" +require_relative "assembly_ai_transcriber" +require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" require_relative "talkscriber_transcriber" @@ -31,6 +33,10 @@ def initialize(member:, discriminant:) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "custom-transcriber" + Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramTranscriber.from_json(json_object: json_object) when "gladia" @@ -38,7 +44,7 @@ def self.from_json(json_object:) when "talkscriber" Vapi::TalkscriberTranscriber.from_json(json_object: json_object) else - Vapi::DeepgramTranscriber.from_json(json_object: json_object) + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) end new(member: member, discriminant: struct.provider) end @@ -48,6 +54,10 @@ def self.from_json(json_object:) # @return [String] def to_json(*_args) case @discriminant + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-transcriber" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "gladia" @@ -68,6 +78,10 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) case obj.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "custom-transcriber" + Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramTranscriber.validate_raw(obj: obj) when "gladia" @@ -87,6 +101,18 @@ def is_a?(obj) @member.is_a?(obj) end + # @param member [Vapi::AssemblyAiTranscriber] + # @return [Vapi::AssistantTranscriber] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CustomTranscriber] + # @return [Vapi::AssistantTranscriber] + def self.custom_transcriber(member:) + new(member: member, discriminant: "custom-transcriber") + end + # @param member [Vapi::DeepgramTranscriber] # @return [Vapi::AssistantTranscriber] def self.deepgram(member:) diff --git a/lib/vapi_server_sdk/types/assistant_voice.rb b/lib/vapi_server_sdk/types/assistant_voice.rb index 4df4885..3cf78fe 100644 --- a/lib/vapi_server_sdk/types/assistant_voice.rb +++ b/lib/vapi_server_sdk/types/assistant_voice.rb @@ -3,6 +3,7 @@ require "json" require_relative "azure_voice" require_relative "cartesia_voice" +require_relative "custom_voice" require_relative "deepgram_voice" require_relative "eleven_labs_voice" require_relative "lmnt_voice" @@ -10,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "tavus_voice" module Vapi # These are the options for the assistant's voice. @@ -41,6 +43,8 @@ def self.from_json(json_object:) Vapi::AzureVoice.from_json(json_object: json_object) when "cartesia" Vapi::CartesiaVoice.from_json(json_object: json_object) + when "custom-voice" + Vapi::CustomVoice.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramVoice.from_json(json_object: json_object) when "11labs" @@ -55,6 +59,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "tavus" + Vapi::TavusVoice.from_json(json_object: json_object) else Vapi::AzureVoice.from_json(json_object: json_object) end @@ -70,6 +76,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "cartesia" { **@member.to_json, provider: @discriminant }.to_json + when "custom-voice" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "11labs" @@ -84,6 +92,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -102,6 +112,8 @@ def self.validate_raw(obj:) Vapi::AzureVoice.validate_raw(obj: obj) when "cartesia" Vapi::CartesiaVoice.validate_raw(obj: obj) + when "custom-voice" + Vapi::CustomVoice.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramVoice.validate_raw(obj: obj) when "11labs" @@ -116,6 +128,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "tavus" + Vapi::TavusVoice.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -141,6 +155,12 @@ def self.cartesia(member:) new(member: member, discriminant: "cartesia") end + # @param member [Vapi::CustomVoice] + # @return [Vapi::AssistantVoice] + def self.custom_voice(member:) + new(member: member, discriminant: "custom-voice") + end + # @param member [Vapi::DeepgramVoice] # @return [Vapi::AssistantVoice] def self.deepgram(member:) @@ -182,5 +202,11 @@ def self.playht(member:) def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + + # @param member [Vapi::TavusVoice] + # @return [Vapi::AssistantVoice] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end end end diff --git a/lib/vapi_server_sdk/types/auto_reload_plan.rb b/lib/vapi_server_sdk/types/auto_reload_plan.rb new file mode 100644 index 0000000..6090b5d --- /dev/null +++ b/lib/vapi_server_sdk/types/auto_reload_plan.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class AutoReloadPlan + # @return [Float] This the amount of credits to reload. + attr_reader :credits + # @return [Float] This is the limit at which the reload is triggered. + attr_reader :threshold + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param credits [Float] This the amount of credits to reload. + # @param threshold [Float] This is the limit at which the reload is triggered. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AutoReloadPlan] + def initialize(credits:, threshold:, additional_properties: nil) + @credits = credits + @threshold = threshold + @additional_properties = additional_properties + @_field_set = { "credits": credits, "threshold": threshold } + end + + # Deserialize a JSON object to an instance of AutoReloadPlan + # + # @param json_object [String] + # @return [Vapi::AutoReloadPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + credits = parsed_json["credits"] + threshold = parsed_json["threshold"] + new( + credits: credits, + threshold: threshold, + additional_properties: struct + ) + end + + # Serialize an instance of AutoReloadPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.credits.is_a?(Float) != false || raise("Passed value for field obj.credits is not the expected type, validation failed.") + obj.threshold.is_a?(Float) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb b/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb new file mode 100644 index 0000000..fc1b2f8 --- /dev/null +++ b/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require_relative "auto_reload_plan" +require "ostruct" +require "json" + +module Vapi + class AutoReloadPlanDto + # @return [Vapi::AutoReloadPlan] This is the auto reload plan to be configured for the subscription. + # It can be null if no auto reload plan is set. + attr_reader :auto_reload_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param auto_reload_plan [Vapi::AutoReloadPlan] This is the auto reload plan to be configured for the subscription. + # It can be null if no auto reload plan is set. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AutoReloadPlanDto] + def initialize(auto_reload_plan: OMIT, additional_properties: nil) + @auto_reload_plan = auto_reload_plan if auto_reload_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "autoReloadPlan": auto_reload_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AutoReloadPlanDto + # + # @param json_object [String] + # @return [Vapi::AutoReloadPlanDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["autoReloadPlan"].nil? + auto_reload_plan = nil + else + auto_reload_plan = parsed_json["autoReloadPlan"].to_json + auto_reload_plan = Vapi::AutoReloadPlan.from_json(json_object: auto_reload_plan) + end + new(auto_reload_plan: auto_reload_plan, additional_properties: struct) + end + + # Serialize an instance of AutoReloadPlanDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.auto_reload_plan.nil? || Vapi::AutoReloadPlan.validate_raw(obj: obj.auto_reload_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/azure_credential.rb b/lib/vapi_server_sdk/types/azure_credential.rb new file mode 100644 index 0000000..60456e6 --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_credential.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +require_relative "azure_credential_region" +require "date" +require "ostruct" +require "json" + +module Vapi + class AzureCredential + # @return [String] + attr_reader :provider + # @return [String] This is the service being used in Azure. + attr_reader :service + # @return [Vapi::AzureCredentialRegion] This is the region of the Azure resource. + attr_reader :region + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param service [String] This is the service being used in Azure. + # @param region [Vapi::AzureCredentialRegion] This is the region of the Azure resource. + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AzureCredential] + def initialize(provider:, service:, id:, org_id:, created_at:, updated_at:, region: OMIT, api_key: OMIT, + name: OMIT, additional_properties: nil) + @provider = provider + @service = service + @region = region if region != OMIT + @api_key = api_key if api_key != OMIT + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "service": service, + "region": region, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AzureCredential + # + # @param json_object [String] + # @return [Vapi::AzureCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + service = parsed_json["service"] + region = parsed_json["region"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + service: service, + region: region, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of AzureCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.region&.is_a?(Vapi::AzureCredentialRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/azure_credential_region.rb b/lib/vapi_server_sdk/types/azure_credential_region.rb new file mode 100644 index 0000000..09f0928 --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_credential_region.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Vapi + # This is the region of the Azure resource. + class AzureCredentialRegion + AUSTRALIA = "australia" + CANADA = "canada" + EASTUS_2 = "eastus2" + EASTUS = "eastus" + FRANCE = "france" + INDIA = "india" + JAPAN = "japan" + UAENORTH = "uaenorth" + NORTHCENTRALUS = "northcentralus" + NORWAY = "norway" + SOUTHCENTRALUS = "southcentralus" + SWEDEN = "sweden" + SWITZERLAND = "switzerland" + UK = "uk" + WESTUS = "westus" + WESTUS_3 = "westus3" + end +end diff --git a/lib/vapi_server_sdk/types/azure_open_ai_credential.rb b/lib/vapi_server_sdk/types/azure_open_ai_credential.rb index bc7278b..d66cb4d 100644 --- a/lib/vapi_server_sdk/types/azure_open_ai_credential.rb +++ b/lib/vapi_server_sdk/types/azure_open_ai_credential.rb @@ -24,6 +24,8 @@ class AzureOpenAiCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] attr_reader :open_ai_endpoint # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -42,11 +44,12 @@ class AzureOpenAiCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param open_ai_endpoint [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AzureOpenAiCredential] def initialize(provider:, region:, models:, open_ai_key:, id:, org_id:, created_at:, updated_at:, - open_ai_endpoint:, additional_properties: nil) + open_ai_endpoint:, name: OMIT, additional_properties: nil) @provider = provider @region = region @models = models @@ -55,6 +58,7 @@ def initialize(provider:, region:, models:, open_ai_key:, id:, org_id:, created_ @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @open_ai_endpoint = open_ai_endpoint @additional_properties = additional_properties @_field_set = { @@ -66,8 +70,11 @@ def initialize(provider:, region:, models:, open_ai_key:, id:, org_id:, created_ "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, + "name": name, "openAIEndpoint": open_ai_endpoint - } + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of AzureOpenAiCredential @@ -85,6 +92,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] open_ai_endpoint = parsed_json["openAIEndpoint"] new( provider: provider, @@ -95,6 +103,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, open_ai_endpoint: open_ai_endpoint, additional_properties: struct ) @@ -122,6 +131,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.open_ai_endpoint.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb b/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb index f497da8..24181af 100644 --- a/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb +++ b/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb @@ -2,6 +2,7 @@ module Vapi class AzureOpenAiCredentialModelsItem + GPT_4_O_20240806 = "gpt-4o-2024-08-06" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O_20240513 = "gpt-4o-2024-05-13" GPT_4_TURBO_20240409 = "gpt-4-turbo-2024-04-09" diff --git a/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb b/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb index 497290d..f403521 100644 --- a/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +++ b/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb @@ -9,6 +9,7 @@ class AzureOpenAiCredentialRegion FRANCE = "france" INDIA = "india" JAPAN = "japan" + UAENORTH = "uaenorth" NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" diff --git a/lib/vapi_server_sdk/types/azure_voice.rb b/lib/vapi_server_sdk/types/azure_voice.rb index 5ca2832..dccb118 100644 --- a/lib/vapi_server_sdk/types/azure_voice.rb +++ b/lib/vapi_server_sdk/types/azure_voice.rb @@ -2,22 +2,22 @@ require_relative "azure_voice_id" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class AzureVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::AzureVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id - # @return [Float] This is the speed multiplier that will be used. - attr_reader :speed # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -26,26 +26,25 @@ class AzureVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::AzureVoiceId] This is the provider-specific ID that will be used. - # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param speed [Float] This is the speed multiplier that will be used. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AzureVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, chunk_plan: OMIT, speed: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id - @speed = speed if speed != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @speed = speed if speed != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, + "chunkPlan": chunk_plan, "speed": speed, - "chunkPlan": chunk_plan + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -58,25 +57,30 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_pla def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else voice_id = parsed_json["voiceId"].to_json voice_id = Vapi::AzureVoiceId.from_json(json_object: voice_id) end - speed = parsed_json["speed"] if parsed_json["chunkPlan"].nil? chunk_plan = nil else chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + speed = parsed_json["speed"] + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, - speed: speed, chunk_plan: chunk_plan, + speed: speed, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -95,10 +99,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::AzureVoiceId.validate_raw(obj: obj.voice_id) - obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/bash_tool.rb b/lib/vapi_server_sdk/types/bash_tool.rb new file mode 100644 index 0000000..9ca5c31 --- /dev/null +++ b/lib/vapi_server_sdk/types/bash_tool.rb @@ -0,0 +1,194 @@ +# frozen_string_literal: true + +require_relative "bash_tool_messages_item" +require "date" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class BashTool + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] This is the unique identifier for the tool. + attr_reader :id + # @return [String] This is the unique identifier for the organization that this tool belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + attr_reader :updated_at + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'bash' + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param id [String] This is the unique identifier for the tool. + # @param org_id [String] This is the unique identifier for the organization that this tool belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the tool was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'bash' + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::BashTool] + def initialize(sub_type:, id:, org_id:, created_at:, updated_at:, name:, async: OMIT, messages: OMIT, function: OMIT, + server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @function = function if function != OMIT + @server = server if server != OMIT + @name = name + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "function": function, + "server": server, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of BashTool + # + # @param json_object [String] + # @return [Vapi::BashTool] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::BashToolMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + new( + async: async, + messages: messages, + sub_type: sub_type, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + function: function, + server: server, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of BashTool to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/bash_tool_messages_item.rb b/lib/vapi_server_sdk/types/bash_tool_messages_item.rb new file mode 100644 index 0000000..369f89c --- /dev/null +++ b/lib/vapi_server_sdk/types/bash_tool_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class BashToolMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::BashToolMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of BashToolMessagesItem + # + # @param json_object [String] + # @return [Vapi::BashToolMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::BashToolMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::BashToolMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::BashToolMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::BashToolMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/block_complete_message.rb b/lib/vapi_server_sdk/types/block_complete_message.rb index ab45626..96a71f9 100644 --- a/lib/vapi_server_sdk/types/block_complete_message.rb +++ b/lib/vapi_server_sdk/types/block_complete_message.rb @@ -1,11 +1,21 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "block_complete_message_conditions_item" require "ostruct" require "json" module Vapi class BlockCompleteMessage + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [Array] This is an optional array of conditions that must be met for this message to be # triggered. attr_reader :conditions @@ -19,16 +29,25 @@ class BlockCompleteMessage OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param conditions [Array] This is an optional array of conditions that must be met for this message to be # triggered. # @param content [String] This is the content that the assistant will say when this message is triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::BlockCompleteMessage] - def initialize(content:, conditions: OMIT, additional_properties: nil) + def initialize(contents: OMIT, conditions: OMIT, content: OMIT, additional_properties: nil) + @contents = contents if contents != OMIT @conditions = conditions if conditions != OMIT - @content = content + @content = content if content != OMIT @additional_properties = additional_properties - @_field_set = { "conditions": conditions, "content": content }.reject do |_k, v| + @_field_set = { "contents": contents, "conditions": conditions, "content": content }.reject do |_k, v| v == OMIT end end @@ -40,12 +59,17 @@ def initialize(content:, conditions: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::BlockCompleteMessageConditionsItem.from_json(json_object: item) end content = parsed_json["content"] new( + contents: contents, conditions: conditions, content: content, additional_properties: struct @@ -66,8 +90,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/block_start_message.rb b/lib/vapi_server_sdk/types/block_start_message.rb index 33b4223..6a05b77 100644 --- a/lib/vapi_server_sdk/types/block_start_message.rb +++ b/lib/vapi_server_sdk/types/block_start_message.rb @@ -1,11 +1,21 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "block_start_message_conditions_item" require "ostruct" require "json" module Vapi class BlockStartMessage + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [Array] This is an optional array of conditions that must be met for this message to be # triggered. attr_reader :conditions @@ -19,16 +29,25 @@ class BlockStartMessage OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param conditions [Array] This is an optional array of conditions that must be met for this message to be # triggered. # @param content [String] This is the content that the assistant will say when this message is triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::BlockStartMessage] - def initialize(content:, conditions: OMIT, additional_properties: nil) + def initialize(contents: OMIT, conditions: OMIT, content: OMIT, additional_properties: nil) + @contents = contents if contents != OMIT @conditions = conditions if conditions != OMIT - @content = content + @content = content if content != OMIT @additional_properties = additional_properties - @_field_set = { "conditions": conditions, "content": content }.reject do |_k, v| + @_field_set = { "contents": contents, "conditions": conditions, "content": content }.reject do |_k, v| v == OMIT end end @@ -40,12 +59,17 @@ def initialize(content:, conditions: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::BlockStartMessageConditionsItem.from_json(json_object: item) end content = parsed_json["content"] new( + contents: contents, conditions: conditions, content: content, additional_properties: struct @@ -66,8 +90,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/both_custom_endpointing_rule.rb b/lib/vapi_server_sdk/types/both_custom_endpointing_rule.rb new file mode 100644 index 0000000..d0ffd65 --- /dev/null +++ b/lib/vapi_server_sdk/types/both_custom_endpointing_rule.rb @@ -0,0 +1,126 @@ +# frozen_string_literal: true + +require_relative "regex_option" +require "ostruct" +require "json" + +module Vapi + class BothCustomEndpointingRule + # @return [String] This is the regex pattern to match the assistant's message. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + attr_reader :assistant_regex + # @return [Array] These are the options for the assistant's message regex match. Defaults to all + # disabled. + # @default [] + attr_reader :assistant_regex_options + # @return [String] + attr_reader :customer_regex + # @return [Array] These are the options for the customer's message regex match. Defaults to all + # disabled. + # @default [] + attr_reader :customer_regex_options + # @return [Float] This is the endpointing timeout in seconds, if the rule is matched. + attr_reader :timeout_seconds + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param assistant_regex [String] This is the regex pattern to match the assistant's message. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + # @param assistant_regex_options [Array] These are the options for the assistant's message regex match. Defaults to all + # disabled. + # @default [] + # @param customer_regex [String] + # @param customer_regex_options [Array] These are the options for the customer's message regex match. Defaults to all + # disabled. + # @default [] + # @param timeout_seconds [Float] This is the endpointing timeout in seconds, if the rule is matched. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::BothCustomEndpointingRule] + def initialize(assistant_regex:, customer_regex:, timeout_seconds:, assistant_regex_options: OMIT, + customer_regex_options: OMIT, additional_properties: nil) + @assistant_regex = assistant_regex + @assistant_regex_options = assistant_regex_options if assistant_regex_options != OMIT + @customer_regex = customer_regex + @customer_regex_options = customer_regex_options if customer_regex_options != OMIT + @timeout_seconds = timeout_seconds + @additional_properties = additional_properties + @_field_set = { + "assistantRegex": assistant_regex, + "assistantRegexOptions": assistant_regex_options, + "customerRegex": customer_regex, + "customerRegexOptions": customer_regex_options, + "timeoutSeconds": timeout_seconds + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of BothCustomEndpointingRule + # + # @param json_object [String] + # @return [Vapi::BothCustomEndpointingRule] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + assistant_regex = parsed_json["assistantRegex"] + assistant_regex_options = parsed_json["assistantRegexOptions"]&.map do |item| + item = item.to_json + Vapi::RegexOption.from_json(json_object: item) + end + customer_regex = parsed_json["customerRegex"] + customer_regex_options = parsed_json["customerRegexOptions"]&.map do |item| + item = item.to_json + Vapi::RegexOption.from_json(json_object: item) + end + timeout_seconds = parsed_json["timeoutSeconds"] + new( + assistant_regex: assistant_regex, + assistant_regex_options: assistant_regex_options, + customer_regex: customer_regex, + customer_regex_options: customer_regex_options, + timeout_seconds: timeout_seconds, + additional_properties: struct + ) + end + + # Serialize an instance of BothCustomEndpointingRule to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.assistant_regex.is_a?(String) != false || raise("Passed value for field obj.assistant_regex is not the expected type, validation failed.") + obj.assistant_regex_options&.is_a?(Array) != false || raise("Passed value for field obj.assistant_regex_options is not the expected type, validation failed.") + obj.customer_regex.is_a?(String) != false || raise("Passed value for field obj.customer_regex is not the expected type, validation failed.") + obj.customer_regex_options&.is_a?(Array) != false || raise("Passed value for field obj.customer_regex_options is not the expected type, validation failed.") + obj.timeout_seconds.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb b/lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb index 81b604f..3a6df1c 100644 --- a/lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb +++ b/lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb @@ -19,10 +19,10 @@ class ByoSipTrunkCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [Array] This is the list of SIP trunk's gateways. attr_reader :gateways - # @return [String] This is the name of the SIP trunk. This is just for your reference. - attr_reader :name # @return [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. attr_reader :outbound_authentication_plan @@ -32,6 +32,12 @@ class ByoSipTrunkCredential # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false attr_reader :outbound_leading_plus_enabled + # @return [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + attr_reader :tech_prefix + # @return [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. + attr_reader :sip_diversion_header # @return [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. @@ -49,8 +55,8 @@ class ByoSipTrunkCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param gateways [Array] This is the list of SIP trunk's gateways. - # @param name [String] This is the name of the SIP trunk. This is just for your reference. # @param outbound_authentication_plan [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. # @param outbound_leading_plus_enabled [Boolean] This ensures the outbound origination attempts have a leading plus. Defaults to @@ -58,22 +64,28 @@ class ByoSipTrunkCredential # Usage: # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false + # @param tech_prefix [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + # @param sip_diversion_header [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. # @param sbc_configuration [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ByoSipTrunkCredential] def initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT, - outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil) + outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, additional_properties: nil) @provider = provider if provider != OMIT @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at - @gateways = gateways @name = name if name != OMIT + @gateways = gateways @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT + @tech_prefix = tech_prefix if tech_prefix != OMIT + @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT @sbc_configuration = sbc_configuration if sbc_configuration != OMIT @additional_properties = additional_properties @_field_set = { @@ -82,10 +94,12 @@ def initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, - "gateways": gateways, "name": name, + "gateways": gateways, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, + "techPrefix": tech_prefix, + "sipDiversionHeader": sip_diversion_header, "sbcConfiguration": sbc_configuration }.reject do |_k, v| v == OMIT @@ -104,11 +118,11 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] gateways = parsed_json["gateways"]&.map do |item| item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) end - name = parsed_json["name"] if parsed_json["outboundAuthenticationPlan"].nil? outbound_authentication_plan = nil else @@ -116,6 +130,8 @@ def self.from_json(json_object:) outbound_authentication_plan = Vapi::SipTrunkOutboundAuthenticationPlan.from_json(json_object: outbound_authentication_plan) end outbound_leading_plus_enabled = parsed_json["outboundLeadingPlusEnabled"] + tech_prefix = parsed_json["techPrefix"] + sip_diversion_header = parsed_json["sipDiversionHeader"] if parsed_json["sbcConfiguration"].nil? sbc_configuration = nil else @@ -128,10 +144,12 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, - gateways: gateways, name: name, + gateways: gateways, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, + tech_prefix: tech_prefix, + sip_diversion_header: sip_diversion_header, sbc_configuration: sbc_configuration, additional_properties: struct ) @@ -156,10 +174,12 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") - obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") + obj.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.") + obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.") obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration) end end diff --git a/lib/vapi_server_sdk/types/call.rb b/lib/vapi_server_sdk/types/call.rb index 62f7ee0..bc1a4a3 100644 --- a/lib/vapi_server_sdk/types/call.rb +++ b/lib/vapi_server_sdk/types/call.rb @@ -14,6 +14,7 @@ require_relative "analysis" require_relative "monitor" require_relative "artifact" +require_relative "transport" require_relative "create_assistant_dto" require_relative "assistant_overrides" require_relative "create_squad_dto" @@ -70,6 +71,8 @@ class Call # @return [Vapi::Artifact] These are the artifacts created from the call. Configure in # `assistant.artifactPlan`. attr_reader :artifact + # @return [Vapi::Transport] This is the transport used for the call. + attr_reader :transport # @return [String] The ID of the call as provided by the phone number service. callSid in Twilio. # conversationUuid in Vonage. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. @@ -141,6 +144,7 @@ class Call # @param monitor [Vapi::Monitor] This is to real-time monitor the call. Configure in `assistant.monitorPlan`. # @param artifact [Vapi::Artifact] These are the artifacts created from the call. Configure in # `assistant.artifactPlan`. + # @param transport [Vapi::Transport] This is the transport used for the call. # @param phone_call_provider_id [String] The ID of the call as provided by the phone number service. callSid in Twilio. # conversationUuid in Vonage. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. @@ -170,7 +174,7 @@ class Call # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Call] def initialize(id:, org_id:, created_at:, updated_at:, type: OMIT, costs: OMIT, messages: OMIT, phone_call_provider: OMIT, phone_call_transport: OMIT, - status: OMIT, ended_reason: OMIT, destination: OMIT, started_at: OMIT, ended_at: OMIT, cost: OMIT, cost_breakdown: OMIT, artifact_plan: OMIT, analysis: OMIT, monitor: OMIT, artifact: OMIT, phone_call_provider_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, additional_properties: nil) + status: OMIT, ended_reason: OMIT, destination: OMIT, started_at: OMIT, ended_at: OMIT, cost: OMIT, cost_breakdown: OMIT, artifact_plan: OMIT, analysis: OMIT, monitor: OMIT, artifact: OMIT, transport: OMIT, phone_call_provider_id: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, name: OMIT, additional_properties: nil) @type = type if type != OMIT @costs = costs if costs != OMIT @messages = messages if messages != OMIT @@ -191,6 +195,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, type: OMIT, costs: OMIT, @analysis = analysis if analysis != OMIT @monitor = monitor if monitor != OMIT @artifact = artifact if artifact != OMIT + @transport = transport if transport != OMIT @phone_call_provider_id = phone_call_provider_id if phone_call_provider_id != OMIT @assistant_id = assistant_id if assistant_id != OMIT @assistant = assistant if assistant != OMIT @@ -224,6 +229,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, type: OMIT, costs: OMIT, "analysis": analysis, "monitor": monitor, "artifact": artifact, + "transport": transport, "phoneCallProviderId": phone_call_provider_id, "assistantId": assistant_id, "assistant": assistant, @@ -303,6 +309,12 @@ def self.from_json(json_object:) artifact = parsed_json["artifact"].to_json artifact = Vapi::Artifact.from_json(json_object: artifact) end + if parsed_json["transport"].nil? + transport = nil + else + transport = parsed_json["transport"].to_json + transport = Vapi::Transport.from_json(json_object: transport) + end phone_call_provider_id = parsed_json["phoneCallProviderId"] assistant_id = parsed_json["assistantId"] if parsed_json["assistant"].nil? @@ -360,6 +372,7 @@ def self.from_json(json_object:) analysis: analysis, monitor: monitor, artifact: artifact, + transport: transport, phone_call_provider_id: phone_call_provider_id, assistant_id: assistant_id, assistant: assistant, @@ -409,6 +422,7 @@ def self.validate_raw(obj:) obj.analysis.nil? || Vapi::Analysis.validate_raw(obj: obj.analysis) obj.monitor.nil? || Vapi::Monitor.validate_raw(obj: obj.monitor) obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact) + obj.transport.nil? || Vapi::Transport.validate_raw(obj: obj.transport) obj.phone_call_provider_id&.is_a?(String) != false || raise("Passed value for field obj.phone_call_provider_id is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) diff --git a/lib/vapi_server_sdk/types/call_ended_reason.rb b/lib/vapi_server_sdk/types/call_ended_reason.rb index 23b898b..331c201 100644 --- a/lib/vapi_server_sdk/types/call_ended_reason.rb +++ b/lib/vapi_server_sdk/types/call_ended_reason.rb @@ -3,32 +3,24 @@ module Vapi # This is the explanation for how the call ended. class CallEndedReason - ASSISTANT_ERROR = "assistant-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - DB_ERROR = "db-error" - NO_SERVER_AVAILABLE = "no-server-available" - LICENSE_CHECK_FAILED = "license-check-failed" - PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" - PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" - PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" - PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" - PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" - PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" - PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" - PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" - PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" - PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED = "pipeline-error-eleven-labs-voice-failed" PIPELINE_ERROR_PLAYHT_VOICE_FAILED = "pipeline-error-playht-voice-failed" PIPELINE_ERROR_LMNT_VOICE_FAILED = "pipeline-error-lmnt-voice-failed" PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" + PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_NO_AVAILABLE_MODEL = "pipeline-no-available-model" WORKER_SHUTDOWN = "worker-shutdown" UNKNOWN_ERROR = "unknown-error" @@ -41,6 +33,16 @@ class CallEndedReason VAPIFAULT_TRANSPORT_NEVER_CONNECTED = "vapifault-transport-never-connected" VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" + VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" + PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" + PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" + PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" + PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" ASSISTANT_NOT_INVALID = "assistant-not-invalid" ASSISTANT_NOT_PROVIDED = "assistant-not-provided" CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" @@ -67,6 +69,21 @@ class CallEndedReason PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA = "pipeline-error-openai-429-exceeded-quota" PIPELINE_ERROR_OPENAI_500_SERVER_ERROR = "pipeline-error-openai-500-server-error" + PIPELINE_ERROR_GOOGLE_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-google-400-bad-request-validation-failed" + PIPELINE_ERROR_GOOGLE_401_UNAUTHORIZED = "pipeline-error-google-401-unauthorized" + PIPELINE_ERROR_GOOGLE_403_MODEL_ACCESS_DENIED = "pipeline-error-google-403-model-access-denied" + PIPELINE_ERROR_GOOGLE_429_EXCEEDED_QUOTA = "pipeline-error-google-429-exceeded-quota" + PIPELINE_ERROR_GOOGLE_500_SERVER_ERROR = "pipeline-error-google-500-server-error" + PIPELINE_ERROR_XAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-xai-400-bad-request-validation-failed" + PIPELINE_ERROR_XAI_401_UNAUTHORIZED = "pipeline-error-xai-401-unauthorized" + PIPELINE_ERROR_XAI_403_MODEL_ACCESS_DENIED = "pipeline-error-xai-403-model-access-denied" + PIPELINE_ERROR_XAI_429_EXCEEDED_QUOTA = "pipeline-error-xai-429-exceeded-quota" + PIPELINE_ERROR_XAI_500_SERVER_ERROR = "pipeline-error-xai-500-server-error" + PIPELINE_ERROR_INFLECTION_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-inflection-ai-400-bad-request-validation-failed" + PIPELINE_ERROR_INFLECTION_AI_401_UNAUTHORIZED = "pipeline-error-inflection-ai-401-unauthorized" + PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" + PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" + PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -82,6 +99,7 @@ class CallEndedReason PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA = "pipeline-error-anthropic-429-exceeded-quota" PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR = "pipeline-error-anthropic-500-server-error" + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-together-ai-400-bad-request-validation-failed" PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED = "pipeline-error-together-ai-401-unauthorized" PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-together-ai-403-model-access-denied" @@ -124,12 +142,12 @@ class CallEndedReason PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA = "pipeline-error-custom-llm-429-exceeded-quota" PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR = "pipeline-error-custom-llm-500-server-error" PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED = "pipeline-error-custom-llm-llm-failed" + PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP = "pipeline-error-cartesia-socket-hang-up" PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT = "pipeline-error-cartesia-requested-payment" PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR = "pipeline-error-cartesia-500-server-error" PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR = "pipeline-error-cartesia-503-server-error" PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR = "pipeline-error-cartesia-522-server-error" - PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND = "pipeline-error-eleven-labs-voice-not-found" PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED = "pipeline-error-eleven-labs-quota-exceeded" PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS = "pipeline-error-eleven-labs-unauthorized-access" @@ -150,10 +168,12 @@ class CallEndedReason PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS = "pipeline-error-eleven-labs-voice-not-allowed-for-free-users" PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR = "pipeline-error-eleven-labs-500-server-error" PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED = "pipeline-error-eleven-labs-max-character-limit-exceeded" + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_VOICE_POTENTIALLY_AGAINST_TERMS_OF_SERVICE_AND_AWAITING_VERIFICATION = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT = "pipeline-error-playht-request-timed-out" PIPELINE_ERROR_PLAYHT_INVALID_VOICE = "pipeline-error-playht-invalid-voice" PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR = "pipeline-error-playht-unexpected-error" PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS = "pipeline-error-playht-out-of-credits" + PIPELINE_ERROR_PLAYHT_INVALID_EMOTION = "pipeline-error-playht-invalid-emotion" PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri" PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED = "pipeline-error-playht-401-unauthorized" PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS = "pipeline-error-playht-403-forbidden-out-of-characters" @@ -161,15 +181,20 @@ class CallEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" - PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-403-model-access-denied" - PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND = "pipeline-error-deepgram-404-not-found" - PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-400-no-such-model-language-tier-combination" - PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON = "pipeline-error-deepgram-500-returning-invalid-json" - SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" + PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" + PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" + PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" + PIPELINE_ERROR_DEEPGRAM_RETURNING_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" + SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" TWILIO_REPORTED_CUSTOMER_MISDIALED = "twilio-reported-customer-misdialed" - VOICEMAIL = "voicemail" VONAGE_REJECTED = "vonage-rejected" + VOICEMAIL = "voicemail" end end diff --git a/lib/vapi_server_sdk/types/call_log_privileged.rb b/lib/vapi_server_sdk/types/call_log_privileged.rb new file mode 100644 index 0000000..2317061 --- /dev/null +++ b/lib/vapi_server_sdk/types/call_log_privileged.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require_relative "call_log_privileged_level" +require "date" +require "ostruct" +require "json" + +module Vapi + class CallLogPrivileged + # @return [String] This is the unique identifier for the call. + attr_reader :call_id + # @return [String] This is the unique identifier for the org that this call log belongs to. + attr_reader :org_id + # @return [String] This is the log message associated with the call. + attr_reader :log + # @return [Vapi::CallLogPrivilegedLevel] This is the level of the log message. + attr_reader :level + # @return [DateTime] This is the ISO 8601 date-time string of when the log was created. + attr_reader :time + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param call_id [String] This is the unique identifier for the call. + # @param org_id [String] This is the unique identifier for the org that this call log belongs to. + # @param log [String] This is the log message associated with the call. + # @param level [Vapi::CallLogPrivilegedLevel] This is the level of the log message. + # @param time [DateTime] This is the ISO 8601 date-time string of when the log was created. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CallLogPrivileged] + def initialize(call_id:, org_id:, log:, level:, time:, additional_properties: nil) + @call_id = call_id + @org_id = org_id + @log = log + @level = level + @time = time + @additional_properties = additional_properties + @_field_set = { "callId": call_id, "orgId": org_id, "log": log, "level": level, "time": time } + end + + # Deserialize a JSON object to an instance of CallLogPrivileged + # + # @param json_object [String] + # @return [Vapi::CallLogPrivileged] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + call_id = parsed_json["callId"] + org_id = parsed_json["orgId"] + log = parsed_json["log"] + level = parsed_json["level"] + time = (DateTime.parse(parsed_json["time"]) unless parsed_json["time"].nil?) + new( + call_id: call_id, + org_id: org_id, + log: log, + level: level, + time: time, + additional_properties: struct + ) + end + + # Serialize an instance of CallLogPrivileged to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.call_id.is_a?(String) != false || raise("Passed value for field obj.call_id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.log.is_a?(String) != false || raise("Passed value for field obj.log is not the expected type, validation failed.") + obj.level.is_a?(Vapi::CallLogPrivilegedLevel) != false || raise("Passed value for field obj.level is not the expected type, validation failed.") + obj.time.is_a?(DateTime) != false || raise("Passed value for field obj.time is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/call_log_privileged_level.rb b/lib/vapi_server_sdk/types/call_log_privileged_level.rb new file mode 100644 index 0000000..e1b3f80 --- /dev/null +++ b/lib/vapi_server_sdk/types/call_log_privileged_level.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Vapi + # This is the level of the log message. + class CallLogPrivilegedLevel + INFO = "INFO" + LOG = "LOG" + WARN = "WARN" + ERROR = "ERROR" + CHECKPOINT = "CHECKPOINT" + end +end diff --git a/lib/vapi_server_sdk/types/call_logs_paginated_response.rb b/lib/vapi_server_sdk/types/call_logs_paginated_response.rb new file mode 100644 index 0000000..1137016 --- /dev/null +++ b/lib/vapi_server_sdk/types/call_logs_paginated_response.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require_relative "call_log_privileged" +require_relative "pagination_meta" +require "ostruct" +require "json" + +module Vapi + class CallLogsPaginatedResponse + # @return [Array] + attr_reader :results + # @return [Vapi::PaginationMeta] + attr_reader :metadata + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param results [Array] + # @param metadata [Vapi::PaginationMeta] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CallLogsPaginatedResponse] + def initialize(results:, metadata:, additional_properties: nil) + @results = results + @metadata = metadata + @additional_properties = additional_properties + @_field_set = { "results": results, "metadata": metadata } + end + + # Deserialize a JSON object to an instance of CallLogsPaginatedResponse + # + # @param json_object [String] + # @return [Vapi::CallLogsPaginatedResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + results = parsed_json["results"]&.map do |item| + item = item.to_json + Vapi::CallLogPrivileged.from_json(json_object: item) + end + if parsed_json["metadata"].nil? + metadata = nil + else + metadata = parsed_json["metadata"].to_json + metadata = Vapi::PaginationMeta.from_json(json_object: metadata) + end + new( + results: results, + metadata: metadata, + additional_properties: struct + ) + end + + # Serialize an instance of CallLogsPaginatedResponse to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") + Vapi::PaginationMeta.validate_raw(obj: obj.metadata) + end + end +end diff --git a/lib/vapi_server_sdk/types/cartesia_credential.rb b/lib/vapi_server_sdk/types/cartesia_credential.rb index 596f5f6..fb0553b 100644 --- a/lib/vapi_server_sdk/types/cartesia_credential.rb +++ b/lib/vapi_server_sdk/types/cartesia_credential.rb @@ -18,6 +18,8 @@ class CartesiaCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class CartesiaCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CartesiaCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CartesiaCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/cartesia_voice.rb b/lib/vapi_server_sdk/types/cartesia_voice.rb index 79f0917..fbe0e4b 100644 --- a/lib/vapi_server_sdk/types/cartesia_voice.rb +++ b/lib/vapi_server_sdk/types/cartesia_voice.rb @@ -3,26 +3,26 @@ require_relative "cartesia_voice_model" require_relative "cartesia_voice_language" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class CartesiaVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::CartesiaVoiceModel] This is the model that will be used. This is optional and will default to the # correct model for the voiceId. attr_reader :model # @return [Vapi::CartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the # correct language for the voiceId. attr_reader :language - # @return [String] This is the provider-specific ID that will be used. - attr_reader :voice_id # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [String] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -31,32 +31,31 @@ class CartesiaVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param model [Vapi::CartesiaVoiceModel] This is the model that will be used. This is optional and will default to the # correct model for the voiceId. # @param language [Vapi::CartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the # correct language for the voiceId. - # @param voice_id [String] This is the provider-specific ID that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param voice_id [String] This is the provider-specific ID that will be used. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CartesiaVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, + def initialize(voice_id:, model: OMIT, language: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT @model = model if model != OMIT @language = language if language != OMIT - @voice_id = voice_id @chunk_plan = chunk_plan if chunk_plan != OMIT + @voice_id = voice_id + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "model": model, "language": language, + "chunkPlan": chunk_plan, "voiceId": voice_id, - "chunkPlan": chunk_plan + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -69,22 +68,27 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, language: def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] model = parsed_json["model"] language = parsed_json["language"] - voice_id = parsed_json["voiceId"] if parsed_json["chunkPlan"].nil? chunk_plan = nil else chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + voice_id = parsed_json["voiceId"] + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, model: model, language: language, - voice_id: voice_id, chunk_plan: chunk_plan, + voice_id: voice_id, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -103,11 +107,11 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") obj.model&.is_a?(Vapi::CartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(Vapi::CartesiaVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") - obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/cartesia_voice_language.rb b/lib/vapi_server_sdk/types/cartesia_voice_language.rb index f4a79f3..ba4537c 100644 --- a/lib/vapi_server_sdk/types/cartesia_voice_language.rb +++ b/lib/vapi_server_sdk/types/cartesia_voice_language.rb @@ -4,12 +4,20 @@ module Vapi # This is the language that will be used. This is optional and will default to the # correct language for the voiceId. class CartesiaVoiceLanguage - DE = "de" EN = "en" + DE = "de" ES = "es" FR = "fr" JA = "ja" PT = "pt" ZH = "zh" + HI = "hi" + IT = "it" + KO = "ko" + NL = "nl" + PL = "pl" + RU = "ru" + SV = "sv" + TR = "tr" end end diff --git a/lib/vapi_server_sdk/types/client_inbound_message_add_message.rb b/lib/vapi_server_sdk/types/client_inbound_message_add_message.rb index b0fd931..213a436 100644 --- a/lib/vapi_server_sdk/types/client_inbound_message_add_message.rb +++ b/lib/vapi_server_sdk/types/client_inbound_message_add_message.rb @@ -8,6 +8,13 @@ module Vapi class ClientInboundMessageAddMessage # @return [Vapi::OpenAiMessage] This is the message to add to the conversation. attr_reader :message + # @return [Boolean] This is the flag to trigger a response, or to insert the message into the + # conversation history silently. Defaults to `true`. + # Usage: + # - Use `true` to trigger a response. + # - Use `false` to insert the message into the conversation history silently. + # @default true + attr_reader :trigger_response_enabled # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -17,12 +24,21 @@ class ClientInboundMessageAddMessage OMIT = Object.new # @param message [Vapi::OpenAiMessage] This is the message to add to the conversation. + # @param trigger_response_enabled [Boolean] This is the flag to trigger a response, or to insert the message into the + # conversation history silently. Defaults to `true`. + # Usage: + # - Use `true` to trigger a response. + # - Use `false` to insert the message into the conversation history silently. + # @default true # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ClientInboundMessageAddMessage] - def initialize(message:, additional_properties: nil) + def initialize(message:, trigger_response_enabled: OMIT, additional_properties: nil) @message = message + @trigger_response_enabled = trigger_response_enabled if trigger_response_enabled != OMIT @additional_properties = additional_properties - @_field_set = { "message": message } + @_field_set = { "message": message, "triggerResponseEnabled": trigger_response_enabled }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of ClientInboundMessageAddMessage @@ -38,7 +54,12 @@ def self.from_json(json_object:) message = parsed_json["message"].to_json message = Vapi::OpenAiMessage.from_json(json_object: message) end - new(message: message, additional_properties: struct) + trigger_response_enabled = parsed_json["triggerResponseEnabled"] + new( + message: message, + trigger_response_enabled: trigger_response_enabled, + additional_properties: struct + ) end # Serialize an instance of ClientInboundMessageAddMessage to a JSON object @@ -56,6 +77,7 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) Vapi::OpenAiMessage.validate_raw(obj: obj.message) + obj.trigger_response_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.trigger_response_enabled is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/client_inbound_message_message.rb b/lib/vapi_server_sdk/types/client_inbound_message_message.rb index e699148..03c9264 100644 --- a/lib/vapi_server_sdk/types/client_inbound_message_message.rb +++ b/lib/vapi_server_sdk/types/client_inbound_message_message.rb @@ -4,6 +4,7 @@ require_relative "client_inbound_message_add_message" require_relative "client_inbound_message_control" require_relative "client_inbound_message_say" +require_relative "client_inbound_message_transfer" module Vapi # These are the messages that can be sent from client-side SDKs to control the @@ -38,6 +39,8 @@ def self.from_json(json_object:) Vapi::ClientInboundMessageControl.from_json(json_object: json_object) when "say" Vapi::ClientInboundMessageSay.from_json(json_object: json_object) + when "transfer" + Vapi::ClientInboundMessageTransfer.from_json(json_object: json_object) else Vapi::ClientInboundMessageAddMessage.from_json(json_object: json_object) end @@ -55,6 +58,8 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "say" { **@member.to_json, type: @discriminant }.to_json + when "transfer" + { **@member.to_json, type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @@ -75,6 +80,8 @@ def self.validate_raw(obj:) Vapi::ClientInboundMessageControl.validate_raw(obj: obj) when "say" Vapi::ClientInboundMessageSay.validate_raw(obj: obj) + when "transfer" + Vapi::ClientInboundMessageTransfer.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -105,5 +112,11 @@ def self.control(member:) def self.say(member:) new(member: member, discriminant: "say") end + + # @param member [Vapi::ClientInboundMessageTransfer] + # @return [Vapi::ClientInboundMessageMessage] + def self.transfer(member:) + new(member: member, discriminant: "transfer") + end end end diff --git a/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb b/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb new file mode 100644 index 0000000..565e77e --- /dev/null +++ b/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require_relative "client_inbound_message_transfer_destination" +require "ostruct" +require "json" + +module Vapi + class ClientInboundMessageTransfer + # @return [Vapi::ClientInboundMessageTransferDestination] This is the destination to transfer the call to. + attr_reader :destination + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param destination [Vapi::ClientInboundMessageTransferDestination] This is the destination to transfer the call to. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ClientInboundMessageTransfer] + def initialize(destination: OMIT, additional_properties: nil) + @destination = destination if destination != OMIT + @additional_properties = additional_properties + @_field_set = { "destination": destination }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of ClientInboundMessageTransfer + # + # @param json_object [String] + # @return [Vapi::ClientInboundMessageTransfer] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["destination"].nil? + destination = nil + else + destination = parsed_json["destination"].to_json + destination = Vapi::ClientInboundMessageTransferDestination.from_json(json_object: destination) + end + new(destination: destination, additional_properties: struct) + end + + # Serialize an instance of ClientInboundMessageTransfer to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.destination.nil? || Vapi::ClientInboundMessageTransferDestination.validate_raw(obj: obj.destination) + end + end +end diff --git a/lib/vapi_server_sdk/types/client_inbound_message_transfer_destination.rb b/lib/vapi_server_sdk/types/client_inbound_message_transfer_destination.rb new file mode 100644 index 0000000..acc42cb --- /dev/null +++ b/lib/vapi_server_sdk/types/client_inbound_message_transfer_destination.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the destination to transfer the call to. + class ClientInboundMessageTransferDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::ClientInboundMessageTransferDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # ClientInboundMessageTransferDestination + # + # @param json_object [String] + # @return [Vapi::ClientInboundMessageTransferDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::ClientInboundMessageTransferDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::ClientInboundMessageTransferDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/client_message_language_changed.rb b/lib/vapi_server_sdk/types/client_message_language_change_detected.rb similarity index 86% rename from lib/vapi_server_sdk/types/client_message_language_changed.rb rename to lib/vapi_server_sdk/types/client_message_language_change_detected.rb index 00ee71c..e6ec0d6 100644 --- a/lib/vapi_server_sdk/types/client_message_language_changed.rb +++ b/lib/vapi_server_sdk/types/client_message_language_change_detected.rb @@ -4,7 +4,7 @@ require "json" module Vapi - class ClientMessageLanguageChanged + class ClientMessageLanguageChangeDetected # @return [String] This is the language the transcriber is switched to. attr_reader :language # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -17,17 +17,17 @@ class ClientMessageLanguageChanged # @param language [String] This is the language the transcriber is switched to. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::ClientMessageLanguageChanged] + # @return [Vapi::ClientMessageLanguageChangeDetected] def initialize(language:, additional_properties: nil) @language = language @additional_properties = additional_properties @_field_set = { "language": language } end - # Deserialize a JSON object to an instance of ClientMessageLanguageChanged + # Deserialize a JSON object to an instance of ClientMessageLanguageChangeDetected # # @param json_object [String] - # @return [Vapi::ClientMessageLanguageChanged] + # @return [Vapi::ClientMessageLanguageChangeDetected] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) @@ -35,7 +35,7 @@ def self.from_json(json_object:) new(language: language, additional_properties: struct) end - # Serialize an instance of ClientMessageLanguageChanged to a JSON object + # Serialize an instance of ClientMessageLanguageChangeDetected to a JSON object # # @return [String] def to_json(*_args) diff --git a/lib/vapi_server_sdk/types/client_message_message.rb b/lib/vapi_server_sdk/types/client_message_message.rb index 25a2010..11c8f4b 100644 --- a/lib/vapi_server_sdk/types/client_message_message.rb +++ b/lib/vapi_server_sdk/types/client_message_message.rb @@ -9,8 +9,9 @@ require_relative "client_message_transcript" require_relative "client_message_tool_calls" require_relative "client_message_tool_calls_result" +require_relative "client_message_transfer_update" require_relative "client_message_user_interrupted" -require_relative "client_message_language_changed" +require_relative "client_message_language_change_detected" require_relative "client_message_voice_input" module Vapi @@ -57,10 +58,12 @@ def self.from_json(json_object:) Vapi::ClientMessageToolCalls.from_json(json_object: json_object) when "tool-calls-result" Vapi::ClientMessageToolCallsResult.from_json(json_object: json_object) + when "transfer-update" + Vapi::ClientMessageTransferUpdate.from_json(json_object: json_object) when "user-interrupted" Vapi::ClientMessageUserInterrupted.from_json(json_object: json_object) - when "language-changed" - Vapi::ClientMessageLanguageChanged.from_json(json_object: json_object) + when "language-change-detected" + Vapi::ClientMessageLanguageChangeDetected.from_json(json_object: json_object) when "voice-input" Vapi::ClientMessageVoiceInput.from_json(json_object: json_object) else @@ -90,9 +93,11 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "tool-calls-result" { **@member.to_json, type: @discriminant }.to_json + when "transfer-update" + { **@member.to_json, type: @discriminant }.to_json when "user-interrupted" { **@member.to_json, type: @discriminant }.to_json - when "language-changed" + when "language-change-detected" { **@member.to_json, type: @discriminant }.to_json when "voice-input" { **@member.to_json, type: @discriminant }.to_json @@ -126,10 +131,12 @@ def self.validate_raw(obj:) Vapi::ClientMessageToolCalls.validate_raw(obj: obj) when "tool-calls-result" Vapi::ClientMessageToolCallsResult.validate_raw(obj: obj) + when "transfer-update" + Vapi::ClientMessageTransferUpdate.validate_raw(obj: obj) when "user-interrupted" Vapi::ClientMessageUserInterrupted.validate_raw(obj: obj) - when "language-changed" - Vapi::ClientMessageLanguageChanged.validate_raw(obj: obj) + when "language-change-detected" + Vapi::ClientMessageLanguageChangeDetected.validate_raw(obj: obj) when "voice-input" Vapi::ClientMessageVoiceInput.validate_raw(obj: obj) else @@ -193,16 +200,22 @@ def self.tool_calls_result(member:) new(member: member, discriminant: "tool-calls-result") end + # @param member [Vapi::ClientMessageTransferUpdate] + # @return [Vapi::ClientMessageMessage] + def self.transfer_update(member:) + new(member: member, discriminant: "transfer-update") + end + # @param member [Vapi::ClientMessageUserInterrupted] # @return [Vapi::ClientMessageMessage] def self.user_interrupted(member:) new(member: member, discriminant: "user-interrupted") end - # @param member [Vapi::ClientMessageLanguageChanged] + # @param member [Vapi::ClientMessageLanguageChangeDetected] # @return [Vapi::ClientMessageMessage] - def self.language_changed(member:) - new(member: member, discriminant: "language-changed") + def self.language_change_detected(member:) + new(member: member, discriminant: "language-change-detected") end # @param member [Vapi::ClientMessageVoiceInput] diff --git a/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb b/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb index 10e3cf6..a4c3508 100644 --- a/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb +++ b/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb @@ -7,22 +7,6 @@ module Vapi class ClientMessageToolCallsToolWithToolCallListItem - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - # Deserialize a JSON object to an instance of # ClientMessageToolCallsToolWithToolCallListItem # @@ -30,34 +14,55 @@ def initialize(member:, discriminant:) # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "function" - Vapi::FunctionToolWithToolCall.from_json(json_object: json_object) - when "ghl" - Vapi::GhlToolWithToolCall.from_json(json_object: json_object) - when "make" - Vapi::MakeToolWithToolCall.from_json(json_object: json_object) - else - Vapi::FunctionToolWithToolCall.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end + begin + Vapi::FunctionToolWithToolCall.validate_raw(obj: struct) + return Vapi::FunctionToolWithToolCall.from_json(json_object: struct) unless struct.nil? - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "function" - { **@member.to_json, type: @discriminant }.to_json - when "ghl" - { **@member.to_json, type: @discriminant }.to_json - when "make" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json + return nil + rescue StandardError + # noop + end + begin + Vapi::GhlToolWithToolCall.validate_raw(obj: struct) + return Vapi::GhlToolWithToolCall.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop end - @member.to_json + begin + Vapi::MakeToolWithToolCall.validate_raw(obj: struct) + return Vapi::MakeToolWithToolCall.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct end # Leveraged for Union-type generation, validate_raw attempts to parse the given @@ -67,42 +72,37 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - case obj.type - when "function" - Vapi::FunctionToolWithToolCall.validate_raw(obj: obj) - when "ghl" - Vapi::GhlToolWithToolCall.validate_raw(obj: obj) - when "make" - Vapi::MakeToolWithToolCall.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") + begin + return Vapi::FunctionToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::FunctionToolWithToolCall] - # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem] - def self.function(member:) - new(member: member, discriminant: "function") - end - - # @param member [Vapi::GhlToolWithToolCall] - # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem] - def self.ghl(member:) - new(member: member, discriminant: "ghl") - end - - # @param member [Vapi::MakeToolWithToolCall] - # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem] - def self.make(member:) - new(member: member, discriminant: "make") + begin + return Vapi::GhlToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::MakeToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/client_message_transfer_update.rb b/lib/vapi_server_sdk/types/client_message_transfer_update.rb new file mode 100644 index 0000000..932e918 --- /dev/null +++ b/lib/vapi_server_sdk/types/client_message_transfer_update.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +require_relative "client_message_transfer_update_destination" +require_relative "create_assistant_dto" +require "ostruct" +require "json" + +module Vapi + class ClientMessageTransferUpdate + # @return [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer. + attr_reader :destination + # @return [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent + # if `destination.type` is "assistant". + attr_reader :to_assistant + # @return [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred from. This is only sent + # if `destination.type` is "assistant". + attr_reader :from_assistant + # @return [Hash{String => Object}] This is the step that the conversation moved to. + attr_reader :to_step_record + # @return [Hash{String => Object}] This is the step that the conversation moved from. = + attr_reader :from_step_record + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param destination [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer. + # @param to_assistant [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent + # if `destination.type` is "assistant". + # @param from_assistant [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred from. This is only sent + # if `destination.type` is "assistant". + # @param to_step_record [Hash{String => Object}] This is the step that the conversation moved to. + # @param from_step_record [Hash{String => Object}] This is the step that the conversation moved from. = + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ClientMessageTransferUpdate] + def initialize(destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, + from_step_record: OMIT, additional_properties: nil) + @destination = destination if destination != OMIT + @to_assistant = to_assistant if to_assistant != OMIT + @from_assistant = from_assistant if from_assistant != OMIT + @to_step_record = to_step_record if to_step_record != OMIT + @from_step_record = from_step_record if from_step_record != OMIT + @additional_properties = additional_properties + @_field_set = { + "destination": destination, + "toAssistant": to_assistant, + "fromAssistant": from_assistant, + "toStepRecord": to_step_record, + "fromStepRecord": from_step_record + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of ClientMessageTransferUpdate + # + # @param json_object [String] + # @return [Vapi::ClientMessageTransferUpdate] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["destination"].nil? + destination = nil + else + destination = parsed_json["destination"].to_json + destination = Vapi::ClientMessageTransferUpdateDestination.from_json(json_object: destination) + end + if parsed_json["toAssistant"].nil? + to_assistant = nil + else + to_assistant = parsed_json["toAssistant"].to_json + to_assistant = Vapi::CreateAssistantDto.from_json(json_object: to_assistant) + end + if parsed_json["fromAssistant"].nil? + from_assistant = nil + else + from_assistant = parsed_json["fromAssistant"].to_json + from_assistant = Vapi::CreateAssistantDto.from_json(json_object: from_assistant) + end + to_step_record = parsed_json["toStepRecord"] + from_step_record = parsed_json["fromStepRecord"] + new( + destination: destination, + to_assistant: to_assistant, + from_assistant: from_assistant, + to_step_record: to_step_record, + from_step_record: from_step_record, + additional_properties: struct + ) + end + + # Serialize an instance of ClientMessageTransferUpdate to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.destination.nil? || Vapi::ClientMessageTransferUpdateDestination.validate_raw(obj: obj.destination) + obj.to_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.to_assistant) + obj.from_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.from_assistant) + obj.to_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.to_step_record is not the expected type, validation failed.") + obj.from_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.from_step_record is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/client_message_transfer_update_destination.rb b/lib/vapi_server_sdk/types/client_message_transfer_update_destination.rb new file mode 100644 index 0000000..6295a43 --- /dev/null +++ b/lib/vapi_server_sdk/types/client_message_transfer_update_destination.rb @@ -0,0 +1,122 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_assistant" +require_relative "transfer_destination_step" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the destination of the transfer. + class ClientMessageTransferUpdateDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # ClientMessageTransferUpdateDestination + # + # @param json_object [String] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "assistant" + Vapi::TransferDestinationAssistant.from_json(json_object: json_object) + when "step" + Vapi::TransferDestinationStep.from_json(json_object: json_object) + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationAssistant.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "assistant" + { **@member.to_json, type: @discriminant }.to_json + when "step" + { **@member.to_json, type: @discriminant }.to_json + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "assistant" + Vapi::TransferDestinationAssistant.validate_raw(obj: obj) + when "step" + Vapi::TransferDestinationStep.validate_raw(obj: obj) + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationAssistant] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def self.assistant(member:) + new(member: member, discriminant: "assistant") + end + + # @param member [Vapi::TransferDestinationStep] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def self.step(member:) + new(member: member, discriminant: "step") + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::ClientMessageTransferUpdateDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/computer_tool.rb b/lib/vapi_server_sdk/types/computer_tool.rb new file mode 100644 index 0000000..4087e99 --- /dev/null +++ b/lib/vapi_server_sdk/types/computer_tool.rb @@ -0,0 +1,218 @@ +# frozen_string_literal: true + +require_relative "computer_tool_messages_item" +require "date" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class ComputerTool + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] This is the unique identifier for the tool. + attr_reader :id + # @return [String] This is the unique identifier for the organization that this tool belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + attr_reader :updated_at + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'computer' + attr_reader :name + # @return [Float] The display width in pixels + attr_reader :display_width_px + # @return [Float] The display height in pixels + attr_reader :display_height_px + # @return [Float] Optional display number + attr_reader :display_number + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param id [String] This is the unique identifier for the tool. + # @param org_id [String] This is the unique identifier for the organization that this tool belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the tool was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'computer' + # @param display_width_px [Float] The display width in pixels + # @param display_height_px [Float] The display height in pixels + # @param display_number [Float] Optional display number + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ComputerTool] + def initialize(sub_type:, id:, org_id:, created_at:, updated_at:, name:, display_width_px:, display_height_px:, async: OMIT, messages: OMIT, function: OMIT, + server: OMIT, display_number: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @function = function if function != OMIT + @server = server if server != OMIT + @name = name + @display_width_px = display_width_px + @display_height_px = display_height_px + @display_number = display_number if display_number != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "function": function, + "server": server, + "name": name, + "displayWidthPx": display_width_px, + "displayHeightPx": display_height_px, + "displayNumber": display_number + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of ComputerTool + # + # @param json_object [String] + # @return [Vapi::ComputerTool] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::ComputerToolMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + display_width_px = parsed_json["displayWidthPx"] + display_height_px = parsed_json["displayHeightPx"] + display_number = parsed_json["displayNumber"] + new( + async: async, + messages: messages, + sub_type: sub_type, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + function: function, + server: server, + name: name, + display_width_px: display_width_px, + display_height_px: display_height_px, + display_number: display_number, + additional_properties: struct + ) + end + + # Serialize an instance of ComputerTool to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.display_width_px.is_a?(Float) != false || raise("Passed value for field obj.display_width_px is not the expected type, validation failed.") + obj.display_height_px.is_a?(Float) != false || raise("Passed value for field obj.display_height_px is not the expected type, validation failed.") + obj.display_number&.is_a?(Float) != false || raise("Passed value for field obj.display_number is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/computer_tool_messages_item.rb b/lib/vapi_server_sdk/types/computer_tool_messages_item.rb new file mode 100644 index 0000000..31c69cb --- /dev/null +++ b/lib/vapi_server_sdk/types/computer_tool_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class ComputerToolMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::ComputerToolMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of ComputerToolMessagesItem + # + # @param json_object [String] + # @return [Vapi::ComputerToolMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::ComputerToolMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::ComputerToolMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::ComputerToolMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::ComputerToolMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/condition.rb b/lib/vapi_server_sdk/types/condition.rb index 5e2f3ab..d6dd9ca 100644 --- a/lib/vapi_server_sdk/types/condition.rb +++ b/lib/vapi_server_sdk/types/condition.rb @@ -6,12 +6,12 @@ module Vapi class Condition - # @return [String] This is the value you want to compare against the parameter. - attr_reader :value # @return [Vapi::ConditionOperator] This is the operator you want to use to compare the parameter and value. attr_reader :operator # @return [String] This is the name of the parameter that you want to check. attr_reader :param + # @return [Hash{String => Object}] This is the value you want to compare against the parameter. + attr_reader :value # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -20,17 +20,17 @@ class Condition OMIT = Object.new - # @param value [String] This is the value you want to compare against the parameter. # @param operator [Vapi::ConditionOperator] This is the operator you want to use to compare the parameter and value. # @param param [String] This is the name of the parameter that you want to check. + # @param value [Hash{String => Object}] This is the value you want to compare against the parameter. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Condition] - def initialize(value:, operator:, param:, additional_properties: nil) - @value = value + def initialize(operator:, param:, value:, additional_properties: nil) @operator = operator @param = param + @value = value @additional_properties = additional_properties - @_field_set = { "value": value, "operator": operator, "param": param } + @_field_set = { "operator": operator, "param": param, "value": value } end # Deserialize a JSON object to an instance of Condition @@ -40,13 +40,13 @@ def initialize(value:, operator:, param:, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - value = parsed_json["value"] operator = parsed_json["operator"] param = parsed_json["param"] + value = parsed_json["value"] new( - value: value, operator: operator, param: param, + value: value, additional_properties: struct ) end @@ -65,9 +65,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.operator.is_a?(Vapi::ConditionOperator) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.") obj.param.is_a?(String) != false || raise("Passed value for field obj.param is not the expected type, validation failed.") + obj.value.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb b/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb index 4a525f5..8019457 100644 --- a/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb @@ -9,6 +9,8 @@ class CreateAnthropicCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateAnthropicCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAnthropicCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateAnthropicCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb b/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb index c79c2d5..200ed6f 100644 --- a/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb @@ -9,6 +9,8 @@ class CreateAnyscaleCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateAnyscaleCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAnyscaleCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateAnyscaleCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb new file mode 100644 index 0000000..367f7c4 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateAssemblyAiCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateAssemblyAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateAssemblyAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateAssemblyAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateAssemblyAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto.rb b/lib/vapi_server_sdk/types/create_assistant_dto.rb index 8fb55bf..bab52bb 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto.rb @@ -15,6 +15,7 @@ require_relative "start_speaking_plan" require_relative "stop_speaking_plan" require_relative "monitor_plan" +require_relative "server" require "ostruct" require "json" @@ -26,6 +27,11 @@ class CreateAssistantDto attr_reader :model # @return [Vapi::CreateAssistantDtoVoice] These are the options for the assistant's voice. attr_reader :voice + # @return [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. + attr_reader :first_message # @return [Vapi::CreateAssistantDtoFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -42,7 +48,7 @@ class CreateAssistantDto # store on your server. Defaults to false. attr_reader :hipaa_enabled # @return [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. attr_reader :client_messages # @return [Array] These are the messages that will be sent to your Server URL. Default is @@ -59,11 +65,6 @@ class CreateAssistantDto # @return [Vapi::CreateAssistantDtoBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. attr_reader :background_sound - # @return [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false - attr_reader :backchanneling_enabled # @return [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -81,11 +82,6 @@ class CreateAssistantDto # @return [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. attr_reader :name - # @return [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. - attr_reader :first_message # @return [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -106,18 +102,6 @@ class CreateAssistantDto attr_reader :end_call_phrases # @return [Hash{String => Object}] This is for metadata you want to store on the assistant. attr_reader :metadata - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret # @return [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. attr_reader :analysis_plan # @return [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in @@ -163,6 +147,13 @@ class CreateAssistantDto # all the credentials are available for use in the call but you can provide a # subset using this. attr_reader :credential_ids + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -174,6 +165,10 @@ class CreateAssistantDto # @param transcriber [Vapi::CreateAssistantDtoTranscriber] These are the options for the assistant's transcriber. # @param model [Vapi::CreateAssistantDtoModel] These are the options for the assistant's LLM. # @param voice [Vapi::CreateAssistantDtoVoice] These are the options for the assistant's voice. + # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to + # a containerized audio file (mp3, wav, etc.). + # If unspecified, assistant will wait for user to speak and use the model to + # respond once they speak. # @param first_message_mode [Vapi::CreateAssistantDtoFirstMessageMode] This is the mode for the first message. Default is 'assistant-speaks-first'. # Use: # - 'assistant-speaks-first' to have the assistant speak first. @@ -188,7 +183,7 @@ class CreateAssistantDto # the end of the call, you will still receive an end-of-call-report message to # store on your server. Defaults to false. # @param client_messages [Array] These are the messages that will be sent to your Client SDKs. Default is - # ,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. + # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input. # You can check the shape of the messages in ClientMessage schema. # @param server_messages [Array] These are the messages that will be sent to your Server URL. Default is # h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. @@ -200,10 +195,6 @@ class CreateAssistantDto # @default 600 (10 minutes) # @param background_sound [Vapi::CreateAssistantDtoBackgroundSound] This is the background sound in the call. Default for phone calls is 'office' # and default for web calls is 'off'. - # @param backchanneling_enabled [Boolean] This determines whether the model says 'mhmm', 'ahem' etc. while user is - # speaking. - # Default `false` while in beta. - # @default false # @param background_denoising_enabled [Boolean] This enables filtering of noise and background speech while the user is talking. # Default `false` while in beta. # @default false @@ -217,10 +208,6 @@ class CreateAssistantDto # call transport provider is used. # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. - # @param first_message [String] This is the first message that the assistant will say. This can also be a URL to - # a containerized audio file (mp3, wav, etc.). - # If unspecified, assistant will wait for user to speak and use the model to - # respond once they speak. # @param voicemail_detection [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. # Alternatively, voicemail detection can be configured using the # model.tools=[VoicemailTool]. @@ -236,16 +223,6 @@ class CreateAssistantDto # @param end_call_phrases [Array] This list contains phrases that, if spoken by the assistant, will trigger the # call to be hung up. Case insensitive. # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > - # org.serverUrl - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - # Same precedence logic as serverUrl. # @param analysis_plan [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`. # @param artifact_plan [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in # `call.artifact`. @@ -284,13 +261,20 @@ class CreateAssistantDto # @param credential_ids [Array] These are the credentials that will be used for the assistant calls. By default, # all the credentials are available for use in the call but you can provide a # subset using this. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server.url + # 2. phoneNumber.serverUrl + # 3. org.serverUrl # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAssistantDto] - def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: OMIT, hipaa_enabled: OMIT, - client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, backchanneling_enabled: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, first_message: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, server_url: OMIT, server_url_secret: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, additional_properties: nil) + def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT + @first_message = first_message if first_message != OMIT @first_message_mode = first_message_mode if first_message_mode != OMIT @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @client_messages = client_messages if client_messages != OMIT @@ -298,19 +282,15 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: @silence_timeout_seconds = silence_timeout_seconds if silence_timeout_seconds != OMIT @max_duration_seconds = max_duration_seconds if max_duration_seconds != OMIT @background_sound = background_sound if background_sound != OMIT - @backchanneling_enabled = backchanneling_enabled if backchanneling_enabled != OMIT @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT @name = name if name != OMIT - @first_message = first_message if first_message != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @voicemail_message = voicemail_message if voicemail_message != OMIT @end_call_message = end_call_message if end_call_message != OMIT @end_call_phrases = end_call_phrases if end_call_phrases != OMIT @metadata = metadata if metadata != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT @analysis_plan = analysis_plan if analysis_plan != OMIT @artifact_plan = artifact_plan if artifact_plan != OMIT @message_plan = message_plan if message_plan != OMIT @@ -318,11 +298,13 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: @stop_speaking_plan = stop_speaking_plan if stop_speaking_plan != OMIT @monitor_plan = monitor_plan if monitor_plan != OMIT @credential_ids = credential_ids if credential_ids != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "transcriber": transcriber, "model": model, "voice": voice, + "firstMessage": first_message, "firstMessageMode": first_message_mode, "hipaaEnabled": hipaa_enabled, "clientMessages": client_messages, @@ -330,26 +312,23 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message_mode: "silenceTimeoutSeconds": silence_timeout_seconds, "maxDurationSeconds": max_duration_seconds, "backgroundSound": background_sound, - "backchannelingEnabled": backchanneling_enabled, "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, "name": name, - "firstMessage": first_message, "voicemailDetection": voicemail_detection, "voicemailMessage": voicemail_message, "endCallMessage": end_call_message, "endCallPhrases": end_call_phrases, "metadata": metadata, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, "analysisPlan": analysis_plan, "artifactPlan": artifact_plan, "messagePlan": message_plan, "startSpeakingPlan": start_speaking_plan, "stopSpeakingPlan": stop_speaking_plan, "monitorPlan": monitor_plan, - "credentialIds": credential_ids + "credentialIds": credential_ids, + "server": server }.reject do |_k, v| v == OMIT end @@ -380,6 +359,7 @@ def self.from_json(json_object:) voice = parsed_json["voice"].to_json voice = Vapi::CreateAssistantDtoVoice.from_json(json_object: voice) end + first_message = parsed_json["firstMessage"] first_message_mode = parsed_json["firstMessageMode"] hipaa_enabled = parsed_json["hipaaEnabled"] client_messages = parsed_json["clientMessages"] @@ -387,7 +367,6 @@ def self.from_json(json_object:) silence_timeout_seconds = parsed_json["silenceTimeoutSeconds"] max_duration_seconds = parsed_json["maxDurationSeconds"] background_sound = parsed_json["backgroundSound"] - backchanneling_enabled = parsed_json["backchannelingEnabled"] background_denoising_enabled = parsed_json["backgroundDenoisingEnabled"] model_output_in_messages_enabled = parsed_json["modelOutputInMessagesEnabled"] transport_configurations = parsed_json["transportConfigurations"]&.map do |item| @@ -395,7 +374,6 @@ def self.from_json(json_object:) Vapi::TransportConfigurationTwilio.from_json(json_object: item) end name = parsed_json["name"] - first_message = parsed_json["firstMessage"] if parsed_json["voicemailDetection"].nil? voicemail_detection = nil else @@ -406,8 +384,6 @@ def self.from_json(json_object:) end_call_message = parsed_json["endCallMessage"] end_call_phrases = parsed_json["endCallPhrases"] metadata = parsed_json["metadata"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] if parsed_json["analysisPlan"].nil? analysis_plan = nil else @@ -445,10 +421,17 @@ def self.from_json(json_object:) monitor_plan = Vapi::MonitorPlan.from_json(json_object: monitor_plan) end credential_ids = parsed_json["credentialIds"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( transcriber: transcriber, model: model, voice: voice, + first_message: first_message, first_message_mode: first_message_mode, hipaa_enabled: hipaa_enabled, client_messages: client_messages, @@ -456,19 +439,15 @@ def self.from_json(json_object:) silence_timeout_seconds: silence_timeout_seconds, max_duration_seconds: max_duration_seconds, background_sound: background_sound, - backchanneling_enabled: backchanneling_enabled, background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, name: name, - first_message: first_message, voicemail_detection: voicemail_detection, voicemail_message: voicemail_message, end_call_message: end_call_message, end_call_phrases: end_call_phrases, metadata: metadata, - server_url: server_url, - server_url_secret: server_url_secret, analysis_plan: analysis_plan, artifact_plan: artifact_plan, message_plan: message_plan, @@ -476,6 +455,7 @@ def self.from_json(json_object:) stop_speaking_plan: stop_speaking_plan, monitor_plan: monitor_plan, credential_ids: credential_ids, + server: server, additional_properties: struct ) end @@ -497,6 +477,7 @@ def self.validate_raw(obj:) obj.transcriber.nil? || Vapi::CreateAssistantDtoTranscriber.validate_raw(obj: obj.transcriber) obj.model.nil? || Vapi::CreateAssistantDtoModel.validate_raw(obj: obj.model) obj.voice.nil? || Vapi::CreateAssistantDtoVoice.validate_raw(obj: obj.voice) + obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.first_message_mode&.is_a?(Vapi::CreateAssistantDtoFirstMessageMode) != false || raise("Passed value for field obj.first_message_mode is not the expected type, validation failed.") obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") obj.client_messages&.is_a?(Array) != false || raise("Passed value for field obj.client_messages is not the expected type, validation failed.") @@ -504,19 +485,15 @@ def self.validate_raw(obj:) obj.silence_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.silence_timeout_seconds is not the expected type, validation failed.") obj.max_duration_seconds&.is_a?(Float) != false || raise("Passed value for field obj.max_duration_seconds is not the expected type, validation failed.") obj.background_sound&.is_a?(Vapi::CreateAssistantDtoBackgroundSound) != false || raise("Passed value for field obj.background_sound is not the expected type, validation failed.") - obj.backchanneling_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.backchanneling_enabled is not the expected type, validation failed.") obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") - obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.") obj.end_call_message&.is_a?(String) != false || raise("Passed value for field obj.end_call_message is not the expected type, validation failed.") obj.end_call_phrases&.is_a?(Array) != false || raise("Passed value for field obj.end_call_phrases is not the expected type, validation failed.") obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") obj.analysis_plan.nil? || Vapi::AnalysisPlan.validate_raw(obj: obj.analysis_plan) obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan) obj.message_plan.nil? || Vapi::MessagePlan.validate_raw(obj: obj.message_plan) @@ -524,6 +501,7 @@ def self.validate_raw(obj:) obj.stop_speaking_plan.nil? || Vapi::StopSpeakingPlan.validate_raw(obj: obj.stop_speaking_plan) obj.monitor_plan.nil? || Vapi::MonitorPlan.validate_raw(obj: obj.monitor_plan) obj.credential_ids&.is_a?(Array) != false || raise("Passed value for field obj.credential_ids is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_client_messages_item.rb b/lib/vapi_server_sdk/types/create_assistant_dto_client_messages_item.rb index 6c10bbf..f70d730 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_client_messages_item.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_client_messages_item.rb @@ -14,6 +14,7 @@ class CreateAssistantDtoClientMessagesItem TRANSCRIPT = "transcript" TOOL_CALLS = "tool-calls" TOOL_CALLS_RESULT = "tool-calls-result" + TRANSFER_UPDATE = "transfer-update" USER_INTERRUPTED = "user-interrupted" VOICE_INPUT = "voice-input" end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_model.rb b/lib/vapi_server_sdk/types/create_assistant_dto_model.rb index 701bbdb..a4d26b4 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_model.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_model.rb @@ -5,12 +5,15 @@ require_relative "anthropic_model" require_relative "custom_llm_model" require_relative "deep_infra_model" +require_relative "google_model" require_relative "groq_model" +require_relative "inflection_ai_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" require_relative "together_ai_model" require_relative "vapi_model" +require_relative "xai_model" module Vapi # These are the options for the assistant's LLM. @@ -46,8 +49,12 @@ def self.from_json(json_object:) Vapi::CustomLlmModel.from_json(json_object: json_object) when "deepinfra" Vapi::DeepInfraModel.from_json(json_object: json_object) + when "google" + Vapi::GoogleModel.from_json(json_object: json_object) when "groq" Vapi::GroqModel.from_json(json_object: json_object) + when "inflection-ai" + Vapi::InflectionAiModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -58,6 +65,8 @@ def self.from_json(json_object:) Vapi::TogetherAiModel.from_json(json_object: json_object) when "vapi" Vapi::VapiModel.from_json(json_object: json_object) + when "xai" + Vapi::XaiModel.from_json(json_object: json_object) else Vapi::AnyscaleModel.from_json(json_object: json_object) end @@ -77,8 +86,12 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "deepinfra" { **@member.to_json, provider: @discriminant }.to_json + when "google" + { **@member.to_json, provider: @discriminant }.to_json when "groq" { **@member.to_json, provider: @discriminant }.to_json + when "inflection-ai" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -89,6 +102,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "vapi" { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -111,8 +126,12 @@ def self.validate_raw(obj:) Vapi::CustomLlmModel.validate_raw(obj: obj) when "deepinfra" Vapi::DeepInfraModel.validate_raw(obj: obj) + when "google" + Vapi::GoogleModel.validate_raw(obj: obj) when "groq" Vapi::GroqModel.validate_raw(obj: obj) + when "inflection-ai" + Vapi::InflectionAiModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -123,6 +142,8 @@ def self.validate_raw(obj:) Vapi::TogetherAiModel.validate_raw(obj: obj) when "vapi" Vapi::VapiModel.validate_raw(obj: obj) + when "xai" + Vapi::XaiModel.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -160,12 +181,24 @@ def self.deepinfra(member:) new(member: member, discriminant: "deepinfra") end + # @param member [Vapi::GoogleModel] + # @return [Vapi::CreateAssistantDtoModel] + def self.google(member:) + new(member: member, discriminant: "google") + end + # @param member [Vapi::GroqModel] # @return [Vapi::CreateAssistantDtoModel] def self.groq(member:) new(member: member, discriminant: "groq") end + # @param member [Vapi::InflectionAiModel] + # @return [Vapi::CreateAssistantDtoModel] + def self.inflection_ai(member:) + new(member: member, discriminant: "inflection-ai") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::CreateAssistantDtoModel] def self.openai(member:) @@ -195,5 +228,11 @@ def self.together_ai(member:) def self.vapi(member:) new(member: member, discriminant: "vapi") end + + # @param member [Vapi::XaiModel] + # @return [Vapi::CreateAssistantDtoModel] + def self.xai(member:) + new(member: member, discriminant: "xai") + end end end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb b/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb index d6f7c28..7584ce0 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb @@ -7,6 +7,7 @@ class CreateAssistantDtoServerMessagesItem FUNCTION_CALL = "function-call" HANG = "hang" LANGUAGE_CHANGED = "language-changed" + LANGUAGE_CHANGE_DETECTED = "language-change-detected" MODEL_OUTPUT = "model-output" PHONE_CALL_CONTROL = "phone-call-control" SPEECH_UPDATE = "speech-update" diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb b/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb index 9988744..785f4a9 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require "json" +require_relative "assembly_ai_transcriber" +require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" require_relative "talkscriber_transcriber" @@ -31,6 +33,10 @@ def initialize(member:, discriminant:) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "custom-transcriber" + Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramTranscriber.from_json(json_object: json_object) when "gladia" @@ -38,7 +44,7 @@ def self.from_json(json_object:) when "talkscriber" Vapi::TalkscriberTranscriber.from_json(json_object: json_object) else - Vapi::DeepgramTranscriber.from_json(json_object: json_object) + Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) end new(member: member, discriminant: struct.provider) end @@ -48,6 +54,10 @@ def self.from_json(json_object:) # @return [String] def to_json(*_args) case @discriminant + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-transcriber" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "gladia" @@ -68,6 +78,10 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) case obj.provider + when "assembly-ai" + Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "custom-transcriber" + Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramTranscriber.validate_raw(obj: obj) when "gladia" @@ -87,6 +101,18 @@ def is_a?(obj) @member.is_a?(obj) end + # @param member [Vapi::AssemblyAiTranscriber] + # @return [Vapi::CreateAssistantDtoTranscriber] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CustomTranscriber] + # @return [Vapi::CreateAssistantDtoTranscriber] + def self.custom_transcriber(member:) + new(member: member, discriminant: "custom-transcriber") + end + # @param member [Vapi::DeepgramTranscriber] # @return [Vapi::CreateAssistantDtoTranscriber] def self.deepgram(member:) diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb b/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb index 11db546..5b2e357 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb @@ -3,6 +3,7 @@ require "json" require_relative "azure_voice" require_relative "cartesia_voice" +require_relative "custom_voice" require_relative "deepgram_voice" require_relative "eleven_labs_voice" require_relative "lmnt_voice" @@ -10,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "tavus_voice" module Vapi # These are the options for the assistant's voice. @@ -41,6 +43,8 @@ def self.from_json(json_object:) Vapi::AzureVoice.from_json(json_object: json_object) when "cartesia" Vapi::CartesiaVoice.from_json(json_object: json_object) + when "custom-voice" + Vapi::CustomVoice.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramVoice.from_json(json_object: json_object) when "11labs" @@ -55,6 +59,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "tavus" + Vapi::TavusVoice.from_json(json_object: json_object) else Vapi::AzureVoice.from_json(json_object: json_object) end @@ -70,6 +76,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "cartesia" { **@member.to_json, provider: @discriminant }.to_json + when "custom-voice" + { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "11labs" @@ -84,6 +92,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @@ -102,6 +112,8 @@ def self.validate_raw(obj:) Vapi::AzureVoice.validate_raw(obj: obj) when "cartesia" Vapi::CartesiaVoice.validate_raw(obj: obj) + when "custom-voice" + Vapi::CustomVoice.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramVoice.validate_raw(obj: obj) when "11labs" @@ -116,6 +128,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "tavus" + Vapi::TavusVoice.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end @@ -141,6 +155,12 @@ def self.cartesia(member:) new(member: member, discriminant: "cartesia") end + # @param member [Vapi::CustomVoice] + # @return [Vapi::CreateAssistantDtoVoice] + def self.custom_voice(member:) + new(member: member, discriminant: "custom-voice") + end + # @param member [Vapi::DeepgramVoice] # @return [Vapi::CreateAssistantDtoVoice] def self.deepgram(member:) @@ -182,5 +202,11 @@ def self.playht(member:) def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + + # @param member [Vapi::TavusVoice] + # @return [Vapi::CreateAssistantDtoVoice] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end end end diff --git a/lib/vapi_server_sdk/types/create_azure_credential_dto.rb b/lib/vapi_server_sdk/types/create_azure_credential_dto.rb new file mode 100644 index 0000000..ae99190 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_azure_credential_dto.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require_relative "create_azure_credential_dto_region" +require "ostruct" +require "json" + +module Vapi + class CreateAzureCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is the service being used in Azure. + attr_reader :service + # @return [Vapi::CreateAzureCredentialDtoRegion] This is the region of the Azure resource. + attr_reader :region + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param service [String] This is the service being used in Azure. + # @param region [Vapi::CreateAzureCredentialDtoRegion] This is the region of the Azure resource. + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateAzureCredentialDto] + def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, additional_properties: nil) + @provider = provider + @service = service + @region = region if region != OMIT + @api_key = api_key if api_key != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "service": service, + "region": region, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateAzureCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateAzureCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + service = parsed_json["service"] + region = parsed_json["region"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + service: service, + region: region, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateAzureCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.region&.is_a?(Vapi::CreateAzureCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb b/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb new file mode 100644 index 0000000..fc733fc --- /dev/null +++ b/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Vapi + # This is the region of the Azure resource. + class CreateAzureCredentialDtoRegion + AUSTRALIA = "australia" + CANADA = "canada" + EASTUS_2 = "eastus2" + EASTUS = "eastus" + FRANCE = "france" + INDIA = "india" + JAPAN = "japan" + UAENORTH = "uaenorth" + NORTHCENTRALUS = "northcentralus" + NORWAY = "norway" + SOUTHCENTRALUS = "southcentralus" + SWEDEN = "sweden" + SWITZERLAND = "switzerland" + UK = "uk" + WESTUS = "westus" + WESTUS_3 = "westus3" + end +end diff --git a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb index e69ec56..0ed3b38 100644 --- a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb @@ -17,6 +17,8 @@ class CreateAzureOpenAiCredentialDto attr_reader :open_ai_key # @return [String] attr_reader :open_ai_endpoint + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -30,22 +32,27 @@ class CreateAzureOpenAiCredentialDto # @param models [Array] # @param open_ai_key [String] This is not returned in the API. # @param open_ai_endpoint [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAzureOpenAiCredentialDto] - def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, additional_properties: nil) + def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, name: OMIT, additional_properties: nil) @provider = provider @region = region @models = models @open_ai_key = open_ai_key @open_ai_endpoint = open_ai_endpoint + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "region": region, "models": models, "openAIKey": open_ai_key, - "openAIEndpoint": open_ai_endpoint - } + "openAIEndpoint": open_ai_endpoint, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateAzureOpenAiCredentialDto @@ -60,12 +67,14 @@ def self.from_json(json_object:) models = parsed_json["models"] open_ai_key = parsed_json["openAIKey"] open_ai_endpoint = parsed_json["openAIEndpoint"] + name = parsed_json["name"] new( provider: provider, region: region, models: models, open_ai_key: open_ai_key, open_ai_endpoint: open_ai_endpoint, + name: name, additional_properties: struct ) end @@ -89,6 +98,7 @@ def self.validate_raw(obj:) obj.models.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") obj.open_ai_key.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") obj.open_ai_endpoint.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb index 4849ccd..9418ba7 100644 --- a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb +++ b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb @@ -2,6 +2,7 @@ module Vapi class CreateAzureOpenAiCredentialDtoModelsItem + GPT_4_O_20240806 = "gpt-4o-2024-08-06" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O_20240513 = "gpt-4o-2024-05-13" GPT_4_TURBO_20240409 = "gpt-4-turbo-2024-04-09" diff --git a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb index ea898ba..efbfd9e 100644 --- a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb @@ -9,6 +9,7 @@ class CreateAzureOpenAiCredentialDtoRegion FRANCE = "france" INDIA = "india" JAPAN = "japan" + UAENORTH = "uaenorth" NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" diff --git a/lib/vapi_server_sdk/types/create_bash_tool_dto.rb b/lib/vapi_server_sdk/types/create_bash_tool_dto.rb new file mode 100644 index 0000000..b46f1c0 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_bash_tool_dto.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require_relative "create_bash_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CreateBashToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] The name of the tool, fixed to 'bash' + attr_reader :name + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param name [String] The name of the tool, fixed to 'bash' + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateBashToolDto] + def initialize(sub_type:, name:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @name = name + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "name": name, + "function": function, + "server": server + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateBashToolDto + # + # @param json_object [String] + # @return [Vapi::CreateBashToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::CreateBashToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + name = parsed_json["name"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + sub_type: sub_type, + name: name, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of CreateBashToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/create_bash_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/create_bash_tool_dto_messages_item.rb new file mode 100644 index 0000000..4ce12e4 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_bash_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class CreateBashToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of CreateBashToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::CreateBashToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb b/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb index c3ceec9..5ed4521 100644 --- a/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb @@ -12,8 +12,6 @@ class CreateByoSipTrunkCredentialDto attr_reader :provider # @return [Array] This is the list of SIP trunk's gateways. attr_reader :gateways - # @return [String] This is the name of the SIP trunk. This is just for your reference. - attr_reader :name # @return [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. attr_reader :outbound_authentication_plan @@ -23,10 +21,18 @@ class CreateByoSipTrunkCredentialDto # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false attr_reader :outbound_leading_plus_enabled + # @return [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + attr_reader :tech_prefix + # @return [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. + attr_reader :sip_diversion_header # @return [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. attr_reader :sbc_configuration + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -37,7 +43,6 @@ class CreateByoSipTrunkCredentialDto # @param provider [String] This can be used to bring your own SIP trunks or to connect to a Carrier. # @param gateways [Array] This is the list of SIP trunk's gateways. - # @param name [String] This is the name of the SIP trunk. This is just for your reference. # @param outbound_authentication_plan [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. # @param outbound_leading_plus_enabled [Boolean] This ensures the outbound origination attempts have a leading plus. Defaults to @@ -45,27 +50,36 @@ class CreateByoSipTrunkCredentialDto # Usage: # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false + # @param tech_prefix [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + # @param sip_diversion_header [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. # @param sbc_configuration [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateByoSipTrunkCredentialDto] - def initialize(gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, - outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil) + def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, + tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil) @provider = provider if provider != OMIT @gateways = gateways - @name = name if name != OMIT @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT + @tech_prefix = tech_prefix if tech_prefix != OMIT + @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT @sbc_configuration = sbc_configuration if sbc_configuration != OMIT + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "gateways": gateways, - "name": name, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, - "sbcConfiguration": sbc_configuration + "techPrefix": tech_prefix, + "sipDiversionHeader": sip_diversion_header, + "sbcConfiguration": sbc_configuration, + "name": name }.reject do |_k, v| v == OMIT end @@ -83,7 +97,6 @@ def self.from_json(json_object:) item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) end - name = parsed_json["name"] if parsed_json["outboundAuthenticationPlan"].nil? outbound_authentication_plan = nil else @@ -91,19 +104,24 @@ def self.from_json(json_object:) outbound_authentication_plan = Vapi::SipTrunkOutboundAuthenticationPlan.from_json(json_object: outbound_authentication_plan) end outbound_leading_plus_enabled = parsed_json["outboundLeadingPlusEnabled"] + tech_prefix = parsed_json["techPrefix"] + sip_diversion_header = parsed_json["sipDiversionHeader"] if parsed_json["sbcConfiguration"].nil? sbc_configuration = nil else sbc_configuration = parsed_json["sbcConfiguration"].to_json sbc_configuration = Vapi::SbcConfiguration.from_json(json_object: sbc_configuration) end + name = parsed_json["name"] new( provider: provider, gateways: gateways, - name: name, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, + tech_prefix: tech_prefix, + sip_diversion_header: sip_diversion_header, sbc_configuration: sbc_configuration, + name: name, additional_properties: struct ) end @@ -124,10 +142,12 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") - obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") + obj.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.") + obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.") obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb b/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb index 88ae62e..32fc17b 100644 --- a/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb @@ -9,6 +9,8 @@ class CreateCartesiaCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateCartesiaCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateCartesiaCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateCartesiaCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_computer_tool_dto.rb b/lib/vapi_server_sdk/types/create_computer_tool_dto.rb new file mode 100644 index 0000000..ef92d91 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_computer_tool_dto.rb @@ -0,0 +1,185 @@ +# frozen_string_literal: true + +require_relative "create_computer_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CreateComputerToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] The name of the tool, fixed to 'computer' + attr_reader :name + # @return [Float] The display width in pixels + attr_reader :display_width_px + # @return [Float] The display height in pixels + attr_reader :display_height_px + # @return [Float] Optional display number + attr_reader :display_number + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param name [String] The name of the tool, fixed to 'computer' + # @param display_width_px [Float] The display width in pixels + # @param display_height_px [Float] The display height in pixels + # @param display_number [Float] Optional display number + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateComputerToolDto] + def initialize(sub_type:, name:, display_width_px:, display_height_px:, async: OMIT, messages: OMIT, + display_number: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @name = name + @display_width_px = display_width_px + @display_height_px = display_height_px + @display_number = display_number if display_number != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "name": name, + "displayWidthPx": display_width_px, + "displayHeightPx": display_height_px, + "displayNumber": display_number, + "function": function, + "server": server + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateComputerToolDto + # + # @param json_object [String] + # @return [Vapi::CreateComputerToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::CreateComputerToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + name = parsed_json["name"] + display_width_px = parsed_json["displayWidthPx"] + display_height_px = parsed_json["displayHeightPx"] + display_number = parsed_json["displayNumber"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + sub_type: sub_type, + name: name, + display_width_px: display_width_px, + display_height_px: display_height_px, + display_number: display_number, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of CreateComputerToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.display_width_px.is_a?(Float) != false || raise("Passed value for field obj.display_width_px is not the expected type, validation failed.") + obj.display_height_px.is_a?(Float) != false || raise("Passed value for field obj.display_height_px is not the expected type, validation failed.") + obj.display_number&.is_a?(Float) != false || raise("Passed value for field obj.display_number is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/create_computer_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/create_computer_tool_dto_messages_item.rb new file mode 100644 index 0000000..92d1b43 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_computer_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class CreateComputerToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of CreateComputerToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::CreateComputerToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb b/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb new file mode 100644 index 0000000..89f0fb1 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb @@ -0,0 +1,137 @@ +# frozen_string_literal: true + +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CreateCustomKnowledgeBaseDto + # @return [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param server [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateCustomKnowledgeBaseDto] + def initialize(server:, additional_properties: nil) + @server = server + @additional_properties = additional_properties + @_field_set = { "server": server } + end + + # Deserialize a JSON object to an instance of CreateCustomKnowledgeBaseDto + # + # @param json_object [String] + # @return [Vapi::CreateCustomKnowledgeBaseDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new(server: server, additional_properties: struct) + end + + # Serialize an instance of CreateCustomKnowledgeBaseDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb b/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb index 0e83cdb..4e35ed0 100644 --- a/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "o_auth_2_authentication_plan" require "ostruct" require "json" @@ -9,6 +10,11 @@ class CreateCustomLlmCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey + attr_reader :authentication_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +25,25 @@ class CreateCustomLlmCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateCustomLlmCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @authentication_plan = authentication_plan if authentication_plan != OMIT + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { + "provider": provider, + "apiKey": api_key, + "authenticationPlan": authentication_plan, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateCustomLlmCredentialDto @@ -37,9 +55,18 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + if parsed_json["authenticationPlan"].nil? + authentication_plan = nil + else + authentication_plan = parsed_json["authenticationPlan"].to_json + authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan) + end + name = parsed_json["name"] new( provider: provider, api_key: api_key, + authentication_plan: authentication_plan, + name: name, additional_properties: struct ) end @@ -60,6 +87,8 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb b/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb index 55c481b..e36f32f 100644 --- a/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb @@ -9,6 +9,8 @@ class CreateDeepInfraCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateDeepInfraCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateDeepInfraCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateDeepInfraCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb b/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb index 1f44761..5a109fc 100644 --- a/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb @@ -12,6 +12,8 @@ class CreateDeepgramCredentialDto # @return [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. attr_reader :api_url + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -24,14 +26,16 @@ class CreateDeepgramCredentialDto # @param api_key [String] This is not returned in the API. # @param api_url [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateDeepgramCredentialDto] - def initialize(provider:, api_key:, api_url: OMIT, additional_properties: nil) + def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @api_url = api_url if api_url != OMIT + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url }.reject do |_k, v| + @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| v == OMIT end end @@ -46,10 +50,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] api_url = parsed_json["apiUrl"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, api_url: api_url, + name: name, additional_properties: struct ) end @@ -71,6 +77,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb b/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb index 5db85fb..65a38af 100644 --- a/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb @@ -9,6 +9,8 @@ class CreateElevenLabsCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateElevenLabsCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateElevenLabsCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateElevenLabsCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb b/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb index 8e4bd18..05f29d0 100644 --- a/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb @@ -9,8 +9,6 @@ module Vapi class CreateGcpCredentialDto # @return [String] attr_reader :provider - # @return [String] This is the name of the GCP credential. This is just for your reference. - attr_reader :name # @return [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. @@ -18,6 +16,8 @@ class CreateGcpCredentialDto attr_reader :gcp_key # @return [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. attr_reader :bucket_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -27,25 +27,25 @@ class CreateGcpCredentialDto OMIT = Object.new # @param provider [String] - # @param name [String] This is the name of the GCP credential. This is just for your reference. # @param gcp_key [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. # The schema is identical to the JSON that GCP outputs. # @param bucket_plan [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGcpCredentialDto] - def initialize(provider:, gcp_key:, name: OMIT, bucket_plan: OMIT, additional_properties: nil) + def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_properties: nil) @provider = provider - @name = name if name != OMIT @gcp_key = gcp_key @bucket_plan = bucket_plan if bucket_plan != OMIT + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, - "name": name, "gcpKey": gcp_key, - "bucketPlan": bucket_plan + "bucketPlan": bucket_plan, + "name": name }.reject do |_k, v| v == OMIT end @@ -59,7 +59,6 @@ def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] - name = parsed_json["name"] if parsed_json["gcpKey"].nil? gcp_key = nil else @@ -72,11 +71,12 @@ def self.from_json(json_object:) bucket_plan = parsed_json["bucketPlan"].to_json bucket_plan = Vapi::BucketPlan.from_json(json_object: bucket_plan) end + name = parsed_json["name"] new( provider: provider, - name: name, gcp_key: gcp_key, bucket_plan: bucket_plan, + name: name, additional_properties: struct ) end @@ -96,9 +96,9 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") Vapi::GcpKey.validate_raw(obj: obj.gcp_key) obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb b/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb index cc139e2..f5a12ef 100644 --- a/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb @@ -9,6 +9,8 @@ class CreateGladiaCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateGladiaCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGladiaCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateGladiaCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb b/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb index 536c4b5..7c920cd 100644 --- a/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb @@ -9,6 +9,8 @@ class CreateGoHighLevelCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateGoHighLevelCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGoHighLevelCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateGoHighLevelCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_google_credential_dto.rb b/lib/vapi_server_sdk/types/create_google_credential_dto.rb new file mode 100644 index 0000000..bf1f49a --- /dev/null +++ b/lib/vapi_server_sdk/types/create_google_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateGoogleCredentialDto + # @return [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateGoogleCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateGoogleCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateGoogleCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateGoogleCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_groq_credential_dto.rb b/lib/vapi_server_sdk/types/create_groq_credential_dto.rb index 4e0aec6..3820091 100644 --- a/lib/vapi_server_sdk/types/create_groq_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_groq_credential_dto.rb @@ -9,6 +9,8 @@ class CreateGroqCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateGroqCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGroqCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateGroqCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_inflection_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_inflection_ai_credential_dto.rb new file mode 100644 index 0000000..0d34e6e --- /dev/null +++ b/lib/vapi_server_sdk/types/create_inflection_ai_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateInflectionAiCredentialDto + # @return [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateInflectionAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateInflectionAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateInflectionAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateInflectionAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb b/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb new file mode 100644 index 0000000..358c82a --- /dev/null +++ b/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateLangfuseCredentialDto + # @return [String] + attr_reader :provider + # @return [String] The public key for Langfuse project. Eg: pk-lf-... + attr_reader :public_key + # @return [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + attr_reader :api_key + # @return [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + attr_reader :api_url + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param public_key [String] The public key for Langfuse project. Eg: pk-lf-... + # @param api_key [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + # @param api_url [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateLangfuseCredentialDto] + def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additional_properties: nil) + @provider = provider + @public_key = public_key + @api_key = api_key + @api_url = api_url + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "publicKey": public_key, + "apiKey": api_key, + "apiUrl": api_url, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateLangfuseCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateLangfuseCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + public_key = parsed_json["publicKey"] + api_key = parsed_json["apiKey"] + api_url = parsed_json["apiUrl"] + name = parsed_json["name"] + new( + provider: provider, + public_key: public_key, + api_key: api_key, + api_url: api_url, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateLangfuseCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.public_key.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_url.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb b/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb index 2a61442..b14b664 100644 --- a/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb @@ -9,6 +9,8 @@ class CreateLmntCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateLmntCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateLmntCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateLmntCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_make_credential_dto.rb b/lib/vapi_server_sdk/types/create_make_credential_dto.rb index 2e20b38..30366ab 100644 --- a/lib/vapi_server_sdk/types/create_make_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_make_credential_dto.rb @@ -13,6 +13,8 @@ class CreateMakeCredentialDto attr_reader :region # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -25,15 +27,25 @@ class CreateMakeCredentialDto # @param team_id [String] Team ID # @param region [String] Region of your application. For example: eu1, eu2, us1, us2 # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateMakeCredentialDto] - def initialize(provider:, team_id:, region:, api_key:, additional_properties: nil) + def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @team_id = team_id @region = region @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "teamId": team_id, "region": region, "apiKey": api_key } + @_field_set = { + "provider": provider, + "teamId": team_id, + "region": region, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateMakeCredentialDto @@ -47,11 +59,13 @@ def self.from_json(json_object:) team_id = parsed_json["teamId"] region = parsed_json["region"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, team_id: team_id, region: region, api_key: api_key, + name: name, additional_properties: struct ) end @@ -74,6 +88,7 @@ def self.validate_raw(obj:) obj.team_id.is_a?(String) != false || raise("Passed value for field obj.team_id is not the expected type, validation failed.") obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb index 3ee37fc..a4b977c 100644 --- a/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb @@ -9,6 +9,8 @@ class CreateOpenAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateOpenAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOpenAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateOpenAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb b/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb index a969d3c..19bde02 100644 --- a/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb @@ -9,6 +9,8 @@ class CreateOpenRouterCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateOpenRouterCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOpenRouterCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateOpenRouterCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_org_dto.rb b/lib/vapi_server_sdk/types/create_org_dto.rb index ba46a22..d61f8a6 100644 --- a/lib/vapi_server_sdk/types/create_org_dto.rb +++ b/lib/vapi_server_sdk/types/create_org_dto.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "create_org_dto_channel" require "ostruct" require "json" @@ -13,8 +14,13 @@ class CreateOrgDto # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. attr_reader :hipaa_enabled + # @return [String] This is the ID of the subscription the org belongs to. + attr_reader :subscription_id # @return [String] This is the name of the org. This is just for your own reference. attr_reader :name + # @return [Vapi::CreateOrgDtoChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + attr_reader :channel # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit @@ -45,7 +51,10 @@ class CreateOrgDto # available for LLM and Voice respectively. # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. + # @param subscription_id [String] This is the ID of the subscription the org belongs to. # @param name [String] This is the name of the org. This is just for your own reference. + # @param channel [Vapi::CreateOrgDtoChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This @@ -59,10 +68,12 @@ class CreateOrgDto # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOrgDto] - def initialize(hipaa_enabled: OMIT, name: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, - concurrency_limit: OMIT, additional_properties: nil) + def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, + server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT + @subscription_id = subscription_id if subscription_id != OMIT @name = name if name != OMIT + @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT @server_url = server_url if server_url != OMIT @server_url_secret = server_url_secret if server_url_secret != OMIT @@ -70,7 +81,9 @@ def initialize(hipaa_enabled: OMIT, name: OMIT, billing_limit: OMIT, server_url: @additional_properties = additional_properties @_field_set = { "hipaaEnabled": hipaa_enabled, + "subscriptionId": subscription_id, "name": name, + "channel": channel, "billingLimit": billing_limit, "serverUrl": server_url, "serverUrlSecret": server_url_secret, @@ -88,14 +101,18 @@ def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) hipaa_enabled = parsed_json["hipaaEnabled"] + subscription_id = parsed_json["subscriptionId"] name = parsed_json["name"] + channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] server_url = parsed_json["serverUrl"] server_url_secret = parsed_json["serverUrlSecret"] concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, + subscription_id: subscription_id, name: name, + channel: channel, billing_limit: billing_limit, server_url: server_url, server_url_secret: server_url_secret, @@ -119,7 +136,9 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") + obj.subscription_id&.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.channel&.is_a?(Vapi::CreateOrgDtoChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_org_dto_channel.rb b/lib/vapi_server_sdk/types/create_org_dto_channel.rb new file mode 100644 index 0000000..57f9993 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_org_dto_channel.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + class CreateOrgDtoChannel + DEFAULT = "default" + WEEKLY = "weekly" + end +end diff --git a/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb index 4a9a15b..4a33fd8 100644 --- a/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb @@ -9,6 +9,8 @@ class CreatePerplexityAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreatePerplexityAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreatePerplexityAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreatePerplexityAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb b/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb index 24669f9..171a225 100644 --- a/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb @@ -11,6 +11,8 @@ class CreatePlayHtCredentialDto attr_reader :api_key # @return [String] attr_reader :user_id + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,18 @@ class CreatePlayHtCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. # @param user_id [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreatePlayHtCredentialDto] - def initialize(provider:, api_key:, user_id:, additional_properties: nil) + def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @user_id = user_id + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id } + @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreatePlayHtCredentialDto @@ -42,10 +48,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] user_id = parsed_json["userId"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, user_id: user_id, + name: name, additional_properties: struct ) end @@ -67,6 +75,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb index b9ab4ad..90c5ee3 100644 --- a/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb @@ -9,6 +9,8 @@ class CreateRimeAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateRimeAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateRimeAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateRimeAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb b/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb index 3f00058..3978a94 100644 --- a/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb @@ -9,6 +9,8 @@ class CreateRunpodCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateRunpodCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateRunpodCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateRunpodCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb b/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb index a610fb3..2484d6c 100644 --- a/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb @@ -17,6 +17,8 @@ class CreateS3CredentialDto attr_reader :s_3_bucket_name # @return [String] The path prefix for the uploaded recording. Ex. "recordings/" attr_reader :s_3_path_prefix + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -31,16 +33,18 @@ class CreateS3CredentialDto # @param region [String] AWS region in which the S3 bucket is located. # @param s_3_bucket_name [String] AWS S3 bucket name. # @param s_3_path_prefix [String] The path prefix for the uploaded recording. Ex. "recordings/" + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateS3CredentialDto] def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, - additional_properties: nil) + name: OMIT, additional_properties: nil) @provider = provider @aws_access_key_id = aws_access_key_id @aws_secret_access_key = aws_secret_access_key @region = region @s_3_bucket_name = s_3_bucket_name @s_3_path_prefix = s_3_path_prefix + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s "awsSecretAccessKey": aws_secret_access_key, "region": region, "s3BucketName": s_3_bucket_name, - "s3PathPrefix": s_3_path_prefix - } + "s3PathPrefix": s_3_path_prefix, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateS3CredentialDto @@ -65,6 +72,7 @@ def self.from_json(json_object:) region = parsed_json["region"] s_3_bucket_name = parsed_json["s3BucketName"] s_3_path_prefix = parsed_json["s3PathPrefix"] + name = parsed_json["name"] new( provider: provider, aws_access_key_id: aws_access_key_id, @@ -72,6 +80,7 @@ def self.from_json(json_object:) region: region, s_3_bucket_name: s_3_bucket_name, s_3_path_prefix: s_3_path_prefix, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.s_3_bucket_name.is_a?(String) != false || raise("Passed value for field obj.s_3_bucket_name is not the expected type, validation failed.") obj.s_3_path_prefix.is_a?(String) != false || raise("Passed value for field obj.s_3_path_prefix is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/knowledge_base.rb b/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb similarity index 53% rename from lib/vapi_server_sdk/types/knowledge_base.rb rename to lib/vapi_server_sdk/types/create_tavus_credential_dto.rb index 821ba90..b02d1a6 100644 --- a/lib/vapi_server_sdk/types/knowledge_base.rb +++ b/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb @@ -4,13 +4,13 @@ require "json" module Vapi - class KnowledgeBase + class CreateTavusCredentialDto # @return [String] attr_reader :provider - # @return [Float] - attr_reader :top_k - # @return [Array] - attr_reader :file_ids + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -20,39 +20,39 @@ class KnowledgeBase OMIT = Object.new # @param provider [String] - # @param top_k [Float] - # @param file_ids [Array] + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::KnowledgeBase] - def initialize(provider:, file_ids:, top_k: OMIT, additional_properties: nil) + # @return [Vapi::CreateTavusCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider - @top_k = top_k if top_k != OMIT - @file_ids = file_ids + @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "topK": top_k, "fileIds": file_ids }.reject do |_k, v| + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end - # Deserialize a JSON object to an instance of KnowledgeBase + # Deserialize a JSON object to an instance of CreateTavusCredentialDto # # @param json_object [String] - # @return [Vapi::KnowledgeBase] + # @return [Vapi::CreateTavusCredentialDto] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] - top_k = parsed_json["topK"] - file_ids = parsed_json["fileIds"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, - top_k: top_k, - file_ids: file_ids, + api_key: api_key, + name: name, additional_properties: struct ) end - # Serialize an instance of KnowledgeBase to a JSON object + # Serialize an instance of CreateTavusCredentialDto to a JSON object # # @return [String] def to_json(*_args) @@ -67,8 +67,8 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.") - obj.file_ids.is_a?(Array) != false || raise("Passed value for field obj.file_ids is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_text_editor_tool_dto.rb b/lib/vapi_server_sdk/types/create_text_editor_tool_dto.rb new file mode 100644 index 0000000..24e2360 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_text_editor_tool_dto.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require_relative "create_text_editor_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CreateTextEditorToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] The name of the tool, fixed to 'str_replace_editor' + attr_reader :name + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param name [String] The name of the tool, fixed to 'str_replace_editor' + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateTextEditorToolDto] + def initialize(sub_type:, name:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @name = name + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "name": name, + "function": function, + "server": server + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateTextEditorToolDto + # + # @param json_object [String] + # @return [Vapi::CreateTextEditorToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::CreateTextEditorToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + name = parsed_json["name"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + sub_type: sub_type, + name: name, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of CreateTextEditorToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/create_text_editor_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/create_text_editor_tool_dto_messages_item.rb new file mode 100644 index 0000000..c584014 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_text_editor_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class CreateTextEditorToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of CreateTextEditorToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::CreateTextEditorToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb index d647e35..cc69880 100644 --- a/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb @@ -9,6 +9,8 @@ class CreateTogetherAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class CreateTogetherAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTogetherAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateTogetherAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb b/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb new file mode 100644 index 0000000..f539967 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require_relative "trieve_knowledge_base_vector_store_search_plan" +require_relative "trieve_knowledge_base_vector_store_create_plan" +require "ostruct" +require "json" + +module Vapi + class CreateTrieveKnowledgeBaseDto + # @return [String] This is the name of the knowledge base. + attr_reader :name + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + attr_reader :vector_store_search_plan + # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + attr_reader :vector_store_create_plan + # @return [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + attr_reader :vector_store_provider_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param name [String] This is the name of the knowledge base. + # @param vector_store_search_plan [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + # @param vector_store_create_plan [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + # @param vector_store_provider_id [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateTrieveKnowledgeBaseDto] + def initialize(vector_store_search_plan:, name: OMIT, vector_store_create_plan: OMIT, + vector_store_provider_id: OMIT, additional_properties: nil) + @name = name if name != OMIT + @vector_store_search_plan = vector_store_search_plan + @vector_store_create_plan = vector_store_create_plan if vector_store_create_plan != OMIT + @vector_store_provider_id = vector_store_provider_id if vector_store_provider_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "name": name, + "vectorStoreSearchPlan": vector_store_search_plan, + "vectorStoreCreatePlan": vector_store_create_plan, + "vectorStoreProviderId": vector_store_provider_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateTrieveKnowledgeBaseDto + # + # @param json_object [String] + # @return [Vapi::CreateTrieveKnowledgeBaseDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + name = parsed_json["name"] + if parsed_json["vectorStoreSearchPlan"].nil? + vector_store_search_plan = nil + else + vector_store_search_plan = parsed_json["vectorStoreSearchPlan"].to_json + vector_store_search_plan = Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.from_json(json_object: vector_store_search_plan) + end + if parsed_json["vectorStoreCreatePlan"].nil? + vector_store_create_plan = nil + else + vector_store_create_plan = parsed_json["vectorStoreCreatePlan"].to_json + vector_store_create_plan = Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.from_json(json_object: vector_store_create_plan) + end + vector_store_provider_id = parsed_json["vectorStoreProviderId"] + new( + name: name, + vector_store_search_plan: vector_store_search_plan, + vector_store_create_plan: vector_store_create_plan, + vector_store_provider_id: vector_store_provider_id, + additional_properties: struct + ) + end + + # Serialize an instance of CreateTrieveKnowledgeBaseDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.validate_raw(obj: obj.vector_store_search_plan) + obj.vector_store_create_plan.nil? || Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.validate_raw(obj: obj.vector_store_create_plan) + obj.vector_store_provider_id&.is_a?(String) != false || raise("Passed value for field obj.vector_store_provider_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb b/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb index fee5f2c..fcb0286 100644 --- a/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb @@ -11,6 +11,8 @@ class CreateTwilioCredentialDto attr_reader :auth_token # @return [String] attr_reader :account_sid + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,23 @@ class CreateTwilioCredentialDto # @param provider [String] # @param auth_token [String] This is not returned in the API. # @param account_sid [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTwilioCredentialDto] - def initialize(provider:, auth_token:, account_sid:, additional_properties: nil) + def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_properties: nil) @provider = provider @auth_token = auth_token @account_sid = account_sid + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "authToken": auth_token, "accountSid": account_sid } + @_field_set = { + "provider": provider, + "authToken": auth_token, + "accountSid": account_sid, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateTwilioCredentialDto @@ -42,10 +53,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] auth_token = parsed_json["authToken"] account_sid = parsed_json["accountSid"] + name = parsed_json["name"] new( provider: provider, auth_token: auth_token, account_sid: account_sid, + name: name, additional_properties: struct ) end @@ -67,6 +80,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.auth_token.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.") obj.account_sid.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb b/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb index bdcd9a2..edc6e05 100644 --- a/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "create_vapi_phone_number_dto_fallback_destination" +require_relative "sip_authentication" require "ostruct" require "json" @@ -17,6 +18,10 @@ class CreateVapiPhoneNumberDto # attached to this number will answer. # This is case-insensitive. attr_reader :sip_uri + # @return [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. + attr_reader :authentication # @return [String] This is the name of the phone number. This is just for your own reference. attr_reader :name # @return [String] This is the assistant that will be used for incoming calls to this phone number. @@ -56,6 +61,9 @@ class CreateVapiPhoneNumberDto # @param sip_uri [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant # attached to this number will answer. # This is case-insensitive. + # @param authentication [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. # @param name [String] This is the name of the phone number. This is just for your own reference. # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent @@ -75,10 +83,11 @@ class CreateVapiPhoneNumberDto # Same precedence logic as serverUrl. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateVapiPhoneNumberDto] - def initialize(sip_uri:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, - server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + def initialize(sip_uri:, fallback_destination: OMIT, authentication: OMIT, name: OMIT, assistant_id: OMIT, + squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @sip_uri = sip_uri + @authentication = authentication if authentication != OMIT @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT @@ -88,6 +97,7 @@ def initialize(sip_uri:, fallback_destination: OMIT, name: OMIT, assistant_id: O @_field_set = { "fallbackDestination": fallback_destination, "sipUri": sip_uri, + "authentication": authentication, "name": name, "assistantId": assistant_id, "squadId": squad_id, @@ -112,6 +122,12 @@ def self.from_json(json_object:) fallback_destination = Vapi::CreateVapiPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) end sip_uri = parsed_json["sipUri"] + if parsed_json["authentication"].nil? + authentication = nil + else + authentication = parsed_json["authentication"].to_json + authentication = Vapi::SipAuthentication.from_json(json_object: authentication) + end name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] @@ -120,6 +136,7 @@ def self.from_json(json_object:) new( fallback_destination: fallback_destination, sip_uri: sip_uri, + authentication: authentication, name: name, assistant_id: assistant_id, squad_id: squad_id, @@ -145,6 +162,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::CreateVapiPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") + obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb b/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb index e0f959f..eb0bff6 100644 --- a/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb @@ -11,6 +11,8 @@ class CreateVonageCredentialDto attr_reader :api_secret # @return [String] attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,23 @@ class CreateVonageCredentialDto # @param provider [String] # @param api_secret [String] This is not returned in the API. # @param api_key [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateVonageCredentialDto] - def initialize(provider:, api_secret:, api_key:, additional_properties: nil) + def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_secret = api_secret @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiSecret": api_secret, "apiKey": api_key } + @_field_set = { + "provider": provider, + "apiSecret": api_secret, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CreateVonageCredentialDto @@ -42,10 +53,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_secret = parsed_json["apiSecret"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_secret: api_secret, api_key: api_key, + name: name, additional_properties: struct ) end @@ -67,6 +80,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_secret.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb b/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb new file mode 100644 index 0000000..549270c --- /dev/null +++ b/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +require_relative "o_auth_2_authentication_plan" +require "ostruct" +require "json" + +module Vapi + class CreateWebhookCredentialDto + # @return [String] + attr_reader :provider + # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. + attr_reader :authentication_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateWebhookCredentialDto] + def initialize(provider:, authentication_plan:, name: OMIT, additional_properties: nil) + @provider = provider + @authentication_plan = authentication_plan + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "authenticationPlan": authentication_plan, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateWebhookCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateWebhookCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + if parsed_json["authenticationPlan"].nil? + authentication_plan = nil + else + authentication_plan = parsed_json["authenticationPlan"].to_json + authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan) + end + name = parsed_json["name"] + new( + provider: provider, + authentication_plan: authentication_plan, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateWebhookCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb new file mode 100644 index 0000000..65a418e --- /dev/null +++ b/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateXAiCredentialDto + # @return [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateXAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateXAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateXAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateXAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/credits_buy_dto.rb b/lib/vapi_server_sdk/types/credits_buy_dto.rb new file mode 100644 index 0000000..6ef1079 --- /dev/null +++ b/lib/vapi_server_sdk/types/credits_buy_dto.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreditsBuyDto + # @return [Float] This is the number of credits to add to the subscription. + attr_reader :credits + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param credits [Float] This is the number of credits to add to the subscription. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreditsBuyDto] + def initialize(credits:, additional_properties: nil) + @credits = credits + @additional_properties = additional_properties + @_field_set = { "credits": credits } + end + + # Deserialize a JSON object to an instance of CreditsBuyDto + # + # @param json_object [String] + # @return [Vapi::CreditsBuyDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + credits = parsed_json["credits"] + new(credits: credits, additional_properties: struct) + end + + # Serialize an instance of CreditsBuyDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.credits.is_a?(Float) != false || raise("Passed value for field obj.credits is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/custom_knowledge_base.rb b/lib/vapi_server_sdk/types/custom_knowledge_base.rb new file mode 100644 index 0000000..6455a2e --- /dev/null +++ b/lib/vapi_server_sdk/types/custom_knowledge_base.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CustomKnowledgeBase + # @return [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + attr_reader :server + # @return [String] This is the id of the knowledge base. + attr_reader :id + # @return [String] This is the org id of the knowledge base. + attr_reader :org_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param server [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + # @param id [String] This is the id of the knowledge base. + # @param org_id [String] This is the org id of the knowledge base. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CustomKnowledgeBase] + def initialize(server:, id:, org_id:, additional_properties: nil) + @server = server + @id = id + @org_id = org_id + @additional_properties = additional_properties + @_field_set = { "server": server, "id": id, "orgId": org_id } + end + + # Deserialize a JSON object to an instance of CustomKnowledgeBase + # + # @param json_object [String] + # @return [Vapi::CustomKnowledgeBase] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + id = parsed_json["id"] + org_id = parsed_json["orgId"] + new( + server: server, + id: id, + org_id: org_id, + additional_properties: struct + ) + end + + # Serialize an instance of CustomKnowledgeBase to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::Server.validate_raw(obj: obj.server) + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/custom_llm_credential.rb b/lib/vapi_server_sdk/types/custom_llm_credential.rb index dd5d848..6a6bf0f 100644 --- a/lib/vapi_server_sdk/types/custom_llm_credential.rb +++ b/lib/vapi_server_sdk/types/custom_llm_credential.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true +require_relative "o_auth_2_authentication_plan" require "date" +require_relative "oauth_2_authentication_session" require "ostruct" require "json" @@ -10,6 +12,9 @@ class CustomLlmCredential attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey + attr_reader :authentication_plan # @return [String] This is the unique identifier for the credential. attr_reader :id # @return [String] This is the unique identifier for the org that this credential belongs to. @@ -18,6 +23,11 @@ class CustomLlmCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [Vapi::Oauth2AuthenticationSession] This is the authentication session for the credential. Available for credentials + # that have an authentication plan. + attr_reader :authentication_session + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -28,28 +38,42 @@ class CustomLlmCredential # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey # @param id [String] This is the unique identifier for the credential. # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param authentication_session [Vapi::Oauth2AuthenticationSession] This is the authentication session for the credential. Available for credentials + # that have an authentication plan. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CustomLlmCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, authentication_plan: OMIT, + authentication_session: OMIT, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @authentication_plan = authentication_plan if authentication_plan != OMIT @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @authentication_session = authentication_session if authentication_session != OMIT + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "apiKey": api_key, + "authenticationPlan": authentication_plan, "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "authenticationSession": authentication_session, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of CustomLlmCredential @@ -61,17 +85,33 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + if parsed_json["authenticationPlan"].nil? + authentication_plan = nil + else + authentication_plan = parsed_json["authenticationPlan"].to_json + authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan) + end id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + if parsed_json["authenticationSession"].nil? + authentication_session = nil + else + authentication_session = parsed_json["authenticationSession"].to_json + authentication_session = Vapi::Oauth2AuthenticationSession.from_json(json_object: authentication_session) + end + name = parsed_json["name"] new( provider: provider, api_key: api_key, + authentication_plan: authentication_plan, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, + authentication_session: authentication_session, + name: name, additional_properties: struct ) end @@ -92,10 +132,13 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.authentication_session.nil? || Vapi::Oauth2AuthenticationSession.validate_raw(obj: obj.authentication_session) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/custom_llm_model.rb b/lib/vapi_server_sdk/types/custom_llm_model.rb index a331f48..226161b 100644 --- a/lib/vapi_server_sdk/types/custom_llm_model.rb +++ b/lib/vapi_server_sdk/types/custom_llm_model.rb @@ -2,8 +2,8 @@ require_relative "open_ai_message" require_relative "custom_llm_model_tools_item" +require_relative "create_custom_knowledge_base_dto" require_relative "custom_llm_model_metadata_send_mode" -require_relative "knowledge_base" require "ostruct" require "json" @@ -19,6 +19,10 @@ class CustomLlmModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [Vapi::CustomLlmModelMetadataSendMode] This determines whether metadata is sent in requests to the custom provider. # - `off` will not send any metadata. payload will look like `{ messages }` # - `variable` will send `assistant.metadata` as a variable on the payload. @@ -37,8 +41,6 @@ class CustomLlmModel # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -69,6 +71,8 @@ class CustomLlmModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param metadata_send_mode [Vapi::CustomLlmModelMetadataSendMode] This determines whether metadata is sent in requests to the custom provider. # - `off` will not send any metadata. payload will look like `{ messages }` # - `variable` will send `assistant.metadata` as a variable on the payload. @@ -83,7 +87,6 @@ class CustomLlmModel # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -98,16 +101,17 @@ class CustomLlmModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CustomLlmModel] - def initialize(url:, model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, metadata_send_mode: OMIT, - temperature: OMIT, knowledge_base: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(url:, model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + metadata_send_mode: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @metadata_send_mode = metadata_send_mode if metadata_send_mode != OMIT @url = url @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -116,11 +120,12 @@ def initialize(url:, model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, metada "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "metadataSendMode": metadata_send_mode, "url": url, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -145,16 +150,17 @@ def self.from_json(json_object:) Vapi::CustomLlmModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - metadata_send_mode = parsed_json["metadataSendMode"] - url = parsed_json["url"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + metadata_send_mode = parsed_json["metadataSendMode"] + url = parsed_json["url"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -162,11 +168,12 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, metadata_send_mode: metadata_send_mode, url: url, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -191,11 +198,12 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.metadata_send_mode&.is_a?(Vapi::CustomLlmModelMetadataSendMode) != false || raise("Passed value for field obj.metadata_send_mode is not the expected type, validation failed.") obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/custom_message.rb b/lib/vapi_server_sdk/types/custom_message.rb new file mode 100644 index 0000000..4449e02 --- /dev/null +++ b/lib/vapi_server_sdk/types/custom_message.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +require_relative "text_content" +require "ostruct" +require "json" + +module Vapi + class CustomMessage + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents + # @return [String] This is a custom message. + attr_reader :type + # @return [String] This is the content that the assistant will say when this message is triggered. + attr_reader :content + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + # @param type [String] This is a custom message. + # @param content [String] This is the content that the assistant will say when this message is triggered. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CustomMessage] + def initialize(type:, contents: OMIT, content: OMIT, additional_properties: nil) + @contents = contents if contents != OMIT + @type = type + @content = content if content != OMIT + @additional_properties = additional_properties + @_field_set = { "contents": contents, "type": type, "content": content }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CustomMessage + # + # @param json_object [String] + # @return [Vapi::CustomMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end + type = parsed_json["type"] + content = parsed_json["content"] + new( + contents: contents, + type: type, + content: content, + additional_properties: struct + ) + end + + # Serialize an instance of CustomMessage to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/custom_transcriber.rb b/lib/vapi_server_sdk/types/custom_transcriber.rb new file mode 100644 index 0000000..e924643 --- /dev/null +++ b/lib/vapi_server_sdk/types/custom_transcriber.rb @@ -0,0 +1,125 @@ +# frozen_string_literal: true + +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class CustomTranscriber + # @return [Vapi::Server] This is where the transcription request will be sent. + # Usage: + # 1. Vapi will initiate a websocket connection with `server.url`. + # 2. Vapi will send an initial text frame with the sample rate. Format: + # ``` + # { + # "type": "start", + # "encoding": "linear16", // 16-bit raw PCM format + # "container": "raw", + # "sampleRate": {{sampleRate}}, + # "channels": 2 // customer is channel 0, assistant is channel 1 + # } + # ``` + # 3. Vapi will send the audio data in 16-bit raw PCM format as binary frames. + # 4. You can read the messages something like this: + # ``` + # ws.on('message', (data, isBinary) => { + # if (isBinary) { + # pcmBuffer = Buffer.concat([pcmBuffer, data]); + # console.log(`Received PCM data, buffer size: ${pcmBuffer.length}`); + # } else { + # console.log('Received message:', JSON.parse(data.toString())); + # } + # }); + # ``` + # 5. You will respond with transcriptions as you have them. Format: + # ``` + # { + # "type": "transcriber-response", + # "transcription": "Hello, world!", + # "channel": "customer" | "assistant" + # } + # ``` + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param server [Vapi::Server] This is where the transcription request will be sent. + # Usage: + # 1. Vapi will initiate a websocket connection with `server.url`. + # 2. Vapi will send an initial text frame with the sample rate. Format: + # ``` + # { + # "type": "start", + # "encoding": "linear16", // 16-bit raw PCM format + # "container": "raw", + # "sampleRate": {{sampleRate}}, + # "channels": 2 // customer is channel 0, assistant is channel 1 + # } + # ``` + # 3. Vapi will send the audio data in 16-bit raw PCM format as binary frames. + # 4. You can read the messages something like this: + # ``` + # ws.on('message', (data, isBinary) => { + # if (isBinary) { + # pcmBuffer = Buffer.concat([pcmBuffer, data]); + # console.log(`Received PCM data, buffer size: ${pcmBuffer.length}`); + # } else { + # console.log('Received message:', JSON.parse(data.toString())); + # } + # }); + # ``` + # 5. You will respond with transcriptions as you have them. Format: + # ``` + # { + # "type": "transcriber-response", + # "transcription": "Hello, world!", + # "channel": "customer" | "assistant" + # } + # ``` + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CustomTranscriber] + def initialize(server:, additional_properties: nil) + @server = server + @additional_properties = additional_properties + @_field_set = { "server": server } + end + + # Deserialize a JSON object to an instance of CustomTranscriber + # + # @param json_object [String] + # @return [Vapi::CustomTranscriber] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new(server: server, additional_properties: struct) + end + + # Serialize an instance of CustomTranscriber to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/custom_voice.rb b/lib/vapi_server_sdk/types/custom_voice.rb new file mode 100644 index 0000000..725b9df --- /dev/null +++ b/lib/vapi_server_sdk/types/custom_voice.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +require_relative "chunk_plan" +require_relative "server" +require_relative "fallback_plan" +require "ostruct" +require "json" + +module Vapi + class CustomVoice + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [Vapi::Server] This is where the voice request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "message": { + # "type": "voice-request", + # "text": "Hello, world!", + # "sampleRate": 24000, + # ...other metadata about the call... + # } + # } + # Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified + # in the request. Here is how the response will be piped to the transport: + # ``` + # response.on('data', (chunk: Buffer) => { + # outputStream.write(chunk); + # }); + # ``` + attr_reader :server + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param server [Vapi::Server] This is where the voice request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "message": { + # "type": "voice-request", + # "text": "Hello, world!", + # "sampleRate": 24000, + # ...other metadata about the call... + # } + # } + # Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified + # in the request. Here is how the response will be piped to the transport: + # ``` + # response.on('data', (chunk: Buffer) => { + # outputStream.write(chunk); + # }); + # ``` + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CustomVoice] + def initialize(server:, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) + @chunk_plan = chunk_plan if chunk_plan != OMIT + @server = server + @fallback_plan = fallback_plan if fallback_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "chunkPlan": chunk_plan, "server": server, "fallbackPlan": fallback_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CustomVoice + # + # @param json_object [String] + # @return [Vapi::CustomVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end + new( + chunk_plan: chunk_plan, + server: server, + fallback_plan: fallback_plan, + additional_properties: struct + ) + end + + # Serialize an instance of CustomVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + Vapi::Server.validate_raw(obj: obj.server) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/customer_custom_endpointing_rule.rb b/lib/vapi_server_sdk/types/customer_custom_endpointing_rule.rb new file mode 100644 index 0000000..026a4b7 --- /dev/null +++ b/lib/vapi_server_sdk/types/customer_custom_endpointing_rule.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +require_relative "regex_option" +require "ostruct" +require "json" + +module Vapi + class CustomerCustomEndpointingRule + # @return [String] This is the regex pattern to match. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + attr_reader :regex + # @return [Array] These are the options for the regex match. Defaults to all disabled. + # @default [] + attr_reader :regex_options + # @return [Float] This is the endpointing timeout in seconds, if the rule is matched. + attr_reader :timeout_seconds + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param regex [String] This is the regex pattern to match. + # Note: + # - This works by using the `RegExp.test` method in Node.JS. Eg. + # `/hello/.test("hello there")` will return `true`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # - `RegExp.test` does substring matching, so `/cat/.test("I love cats")` will + # return `true`. To do full string matching, send "^cat$". + # @param regex_options [Array] These are the options for the regex match. Defaults to all disabled. + # @default [] + # @param timeout_seconds [Float] This is the endpointing timeout in seconds, if the rule is matched. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CustomerCustomEndpointingRule] + def initialize(regex:, timeout_seconds:, regex_options: OMIT, additional_properties: nil) + @regex = regex + @regex_options = regex_options if regex_options != OMIT + @timeout_seconds = timeout_seconds + @additional_properties = additional_properties + @_field_set = { + "regex": regex, + "regexOptions": regex_options, + "timeoutSeconds": timeout_seconds + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CustomerCustomEndpointingRule + # + # @param json_object [String] + # @return [Vapi::CustomerCustomEndpointingRule] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + regex = parsed_json["regex"] + regex_options = parsed_json["regexOptions"]&.map do |item| + item = item.to_json + Vapi::RegexOption.from_json(json_object: item) + end + timeout_seconds = parsed_json["timeoutSeconds"] + new( + regex: regex, + regex_options: regex_options, + timeout_seconds: timeout_seconds, + additional_properties: struct + ) + end + + # Serialize an instance of CustomerCustomEndpointingRule to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.regex.is_a?(String) != false || raise("Passed value for field obj.regex is not the expected type, validation failed.") + obj.regex_options&.is_a?(Array) != false || raise("Passed value for field obj.regex_options is not the expected type, validation failed.") + obj.timeout_seconds.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/deep_infra_credential.rb b/lib/vapi_server_sdk/types/deep_infra_credential.rb index 7ad742c..4e3a7bd 100644 --- a/lib/vapi_server_sdk/types/deep_infra_credential.rb +++ b/lib/vapi_server_sdk/types/deep_infra_credential.rb @@ -18,6 +18,8 @@ class DeepInfraCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class DeepInfraCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::DeepInfraCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of DeepInfraCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/deep_infra_model.rb b/lib/vapi_server_sdk/types/deep_infra_model.rb index 2c46554..c1c69c7 100644 --- a/lib/vapi_server_sdk/types/deep_infra_model.rb +++ b/lib/vapi_server_sdk/types/deep_infra_model.rb @@ -2,7 +2,7 @@ require_relative "open_ai_message" require_relative "deep_infra_model_tools_item" -require_relative "knowledge_base" +require_relative "create_custom_knowledge_base_dto" require "ostruct" require "json" @@ -18,13 +18,15 @@ class DeepInfraModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -55,10 +57,11 @@ class DeepInfraModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -73,14 +76,15 @@ class DeepInfraModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::DeepInfraModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -89,9 +93,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -116,14 +121,15 @@ def self.from_json(json_object:) Vapi::DeepInfraModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -131,9 +137,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -158,9 +165,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/deepgram_credential.rb b/lib/vapi_server_sdk/types/deepgram_credential.rb index cbfe85d..fbd47b5 100644 --- a/lib/vapi_server_sdk/types/deepgram_credential.rb +++ b/lib/vapi_server_sdk/types/deepgram_credential.rb @@ -18,6 +18,8 @@ class DeepgramCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. attr_reader :api_url @@ -35,11 +37,12 @@ class DeepgramCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param api_url [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::DeepgramCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, api_url: OMIT, + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, api_url: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @@ -47,6 +50,7 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, api_ @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @api_url = api_url if api_url != OMIT @additional_properties = additional_properties @_field_set = { @@ -56,6 +60,7 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, api_ "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, + "name": name, "apiUrl": api_url }.reject do |_k, v| v == OMIT @@ -75,6 +80,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] api_url = parsed_json["apiUrl"] new( provider: provider, @@ -83,6 +89,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, api_url: api_url, additional_properties: struct ) @@ -108,6 +115,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/deepgram_transcriber.rb b/lib/vapi_server_sdk/types/deepgram_transcriber.rb index 3b18490..94b9433 100644 --- a/lib/vapi_server_sdk/types/deepgram_transcriber.rb +++ b/lib/vapi_server_sdk/types/deepgram_transcriber.rb @@ -17,9 +17,38 @@ class DeepgramTranscriber # @return [Boolean] This will be use smart format option provided by Deepgram. It's default disabled # because it can sometimes format numbers as times but it's getting better. attr_reader :smart_format - # @return [Boolean] This enables or disables language detection. If true, swaps transcribers to - # detected language automatically. Defaults to false. - attr_reader :language_detection_enabled + # @return [Boolean] This automatically switches the transcriber's language when the customer's + # language changes. Defaults to false. + # Usage: + # - If your customers switch languages mid-call, you can set this to true. + # Note: + # - To detect language changes, Vapi uses a custom trained model. Languages + # supported (X = limited support): + # 1. Arabic + # 2. Bengali + # 3. Cantonese + # 4. Chinese + # 5. Chinese Simplified (X) + # 6. Chinese Traditional (X) + # 7. English + # 8. Farsi (X) + # 9. French + # 10. German + # 11. Haitian Creole (X) + # 12. Hindi + # 13. Italian + # 14. Japanese + # 15. Korean + # 16. Portuguese + # 17. Russian + # 18. Spanish + # 19. Thai + # 20. Urdu + # 21. Vietnamese + # - To receive `language-change-detected` webhook events, add it to + # `assistant.serverMessages`. + # @default false + attr_reader :code_switching_enabled # @return [Array] These keywords are passed to the transcription model to help it pick up use-case # specific words. Anything that may not be a common word, like your company name, # should be added here. @@ -53,8 +82,37 @@ class DeepgramTranscriber # https://developers.deepgram.com/docs/models-languages-overview # @param smart_format [Boolean] This will be use smart format option provided by Deepgram. It's default disabled # because it can sometimes format numbers as times but it's getting better. - # @param language_detection_enabled [Boolean] This enables or disables language detection. If true, swaps transcribers to - # detected language automatically. Defaults to false. + # @param code_switching_enabled [Boolean] This automatically switches the transcriber's language when the customer's + # language changes. Defaults to false. + # Usage: + # - If your customers switch languages mid-call, you can set this to true. + # Note: + # - To detect language changes, Vapi uses a custom trained model. Languages + # supported (X = limited support): + # 1. Arabic + # 2. Bengali + # 3. Cantonese + # 4. Chinese + # 5. Chinese Simplified (X) + # 6. Chinese Traditional (X) + # 7. English + # 8. Farsi (X) + # 9. French + # 10. German + # 11. Haitian Creole (X) + # 12. Hindi + # 13. Italian + # 14. Japanese + # 15. Korean + # 16. Portuguese + # 17. Russian + # 18. Spanish + # 19. Thai + # 20. Urdu + # 21. Vietnamese + # - To receive `language-change-detected` webhook events, add it to + # `assistant.serverMessages`. + # @default false # @param keywords [Array] These keywords are passed to the transcription model to help it pick up use-case # specific words. Anything that may not be a common word, like your company name, # should be added here. @@ -73,12 +131,12 @@ class DeepgramTranscriber # @default 10 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::DeepgramTranscriber] - def initialize(model: OMIT, language: OMIT, smart_format: OMIT, language_detection_enabled: OMIT, keywords: OMIT, + def initialize(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) @model = model if model != OMIT @language = language if language != OMIT @smart_format = smart_format if smart_format != OMIT - @language_detection_enabled = language_detection_enabled if language_detection_enabled != OMIT + @code_switching_enabled = code_switching_enabled if code_switching_enabled != OMIT @keywords = keywords if keywords != OMIT @endpointing = endpointing if endpointing != OMIT @additional_properties = additional_properties @@ -86,7 +144,7 @@ def initialize(model: OMIT, language: OMIT, smart_format: OMIT, language_detecti "model": model, "language": language, "smartFormat": smart_format, - "languageDetectionEnabled": language_detection_enabled, + "codeSwitchingEnabled": code_switching_enabled, "keywords": keywords, "endpointing": endpointing }.reject do |_k, v| @@ -104,14 +162,14 @@ def self.from_json(json_object:) model = parsed_json["model"] language = parsed_json["language"] smart_format = parsed_json["smartFormat"] - language_detection_enabled = parsed_json["languageDetectionEnabled"] + code_switching_enabled = parsed_json["codeSwitchingEnabled"] keywords = parsed_json["keywords"] endpointing = parsed_json["endpointing"] new( model: model, language: language, smart_format: smart_format, - language_detection_enabled: language_detection_enabled, + code_switching_enabled: code_switching_enabled, keywords: keywords, endpointing: endpointing, additional_properties: struct @@ -135,7 +193,7 @@ def self.validate_raw(obj:) obj.model&.is_a?(Vapi::DeepgramTranscriberModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(Vapi::DeepgramTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") obj.smart_format&.is_a?(Boolean) != false || raise("Passed value for field obj.smart_format is not the expected type, validation failed.") - obj.language_detection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection_enabled is not the expected type, validation failed.") + obj.code_switching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.code_switching_enabled is not the expected type, validation failed.") obj.keywords&.is_a?(Array) != false || raise("Passed value for field obj.keywords is not the expected type, validation failed.") obj.endpointing&.is_a?(Float) != false || raise("Passed value for field obj.endpointing is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/deepgram_voice.rb b/lib/vapi_server_sdk/types/deepgram_voice.rb index a9c2cfb..052dd62 100644 --- a/lib/vapi_server_sdk/types/deepgram_voice.rb +++ b/lib/vapi_server_sdk/types/deepgram_voice.rb @@ -2,20 +2,20 @@ require_relative "deepgram_voice_id" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class DeepgramVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::DeepgramVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -24,24 +24,19 @@ class DeepgramVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::DeepgramVoiceId] This is the provider-specific ID that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::DeepgramVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties - @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, - "voiceId": voice_id, - "chunkPlan": chunk_plan - }.reject do |_k, v| + @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan, "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end end @@ -53,7 +48,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, chunk_plan: OMIT, addi def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -66,10 +60,16 @@ def self.from_json(json_object:) chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -88,9 +88,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::DeepgramVoiceId.validate_raw(obj: obj.voice_id) obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/eleven_labs_credential.rb b/lib/vapi_server_sdk/types/eleven_labs_credential.rb index 0ed4720..487382c 100644 --- a/lib/vapi_server_sdk/types/eleven_labs_credential.rb +++ b/lib/vapi_server_sdk/types/eleven_labs_credential.rb @@ -18,6 +18,8 @@ class ElevenLabsCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class ElevenLabsCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ElevenLabsCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of ElevenLabsCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/eleven_labs_voice.rb b/lib/vapi_server_sdk/types/eleven_labs_voice.rb index c1baa25..cf879ca 100644 --- a/lib/vapi_server_sdk/types/eleven_labs_voice.rb +++ b/lib/vapi_server_sdk/types/eleven_labs_voice.rb @@ -3,15 +3,12 @@ require_relative "eleven_labs_voice_id" require_relative "eleven_labs_voice_model" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class ElevenLabsVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::ElevenLabsVoiceId] This is the provider-specific ID that will be used. Ensure the Voice is present # in your 11Labs Voice Library. attr_reader :voice_id @@ -33,13 +30,16 @@ class ElevenLabsVoice # @return [Vapi::ElevenLabsVoiceModel] This is the model that will be used. Defaults to 'eleven_turbo_v2' if not # specified. attr_reader :model + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan # @return [String] This is the language (ISO 639-1) that is enforced for the model. Currently only # Turbo v2.5 supports language enforcement. For other models, an error will be # returned if language code is provided. attr_reader :language - # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice - # provider. - attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -48,9 +48,6 @@ class ElevenLabsVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::ElevenLabsVoiceId] This is the provider-specific ID that will be used. Ensure the Voice is present # in your 11Labs Voice Library. # @param stability [Float] Defines the stability for voice settings. @@ -64,16 +61,17 @@ class ElevenLabsVoice # @default false # @param model [Vapi::ElevenLabsVoiceModel] This is the model that will be used. Defaults to 'eleven_turbo_v2' if not # specified. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. # @param language [String] This is the language (ISO 639-1) that is enforced for the model. Currently only # Turbo v2.5 supports language enforcement. For other models, an error will be # returned if language code is provided. - # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice - # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ElevenLabsVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, stability: OMIT, similarity_boost: OMIT, style: OMIT, - use_speaker_boost: OMIT, optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, stability: OMIT, similarity_boost: OMIT, style: OMIT, use_speaker_boost: OMIT, + optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, chunk_plan: OMIT, language: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @stability = stability if stability != OMIT @similarity_boost = similarity_boost if similarity_boost != OMIT @@ -82,11 +80,11 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, stability: OMIT, simil @optimize_streaming_latency = optimize_streaming_latency if optimize_streaming_latency != OMIT @enable_ssml_parsing = enable_ssml_parsing if enable_ssml_parsing != OMIT @model = model if model != OMIT - @language = language if language != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @language = language if language != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, "stability": stability, "similarityBoost": similarity_boost, @@ -95,8 +93,9 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, stability: OMIT, simil "optimizeStreamingLatency": optimize_streaming_latency, "enableSsmlParsing": enable_ssml_parsing, "model": model, + "chunkPlan": chunk_plan, "language": language, - "chunkPlan": chunk_plan + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -109,7 +108,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, stability: OMIT, simil def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -123,15 +121,20 @@ def self.from_json(json_object:) optimize_streaming_latency = parsed_json["optimizeStreamingLatency"] enable_ssml_parsing = parsed_json["enableSsmlParsing"] model = parsed_json["model"] - language = parsed_json["language"] if parsed_json["chunkPlan"].nil? chunk_plan = nil else chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + language = parsed_json["language"] + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, stability: stability, similarity_boost: similarity_boost, @@ -140,8 +143,9 @@ def self.from_json(json_object:) optimize_streaming_latency: optimize_streaming_latency, enable_ssml_parsing: enable_ssml_parsing, model: model, - language: language, chunk_plan: chunk_plan, + language: language, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -160,7 +164,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::ElevenLabsVoiceId.validate_raw(obj: obj.voice_id) obj.stability&.is_a?(Float) != false || raise("Passed value for field obj.stability is not the expected type, validation failed.") obj.similarity_boost&.is_a?(Float) != false || raise("Passed value for field obj.similarity_boost is not the expected type, validation failed.") @@ -169,8 +172,9 @@ def self.validate_raw(obj:) obj.optimize_streaming_latency&.is_a?(Float) != false || raise("Passed value for field obj.optimize_streaming_latency is not the expected type, validation failed.") obj.enable_ssml_parsing&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_ssml_parsing is not the expected type, validation failed.") obj.model&.is_a?(Vapi::ElevenLabsVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") - obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/fallback_azure_voice.rb b/lib/vapi_server_sdk/types/fallback_azure_voice.rb new file mode 100644 index 0000000..305a456 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_azure_voice.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +require_relative "fallback_azure_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackAzureVoice + # @return [Vapi::FallbackAzureVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [Object] + attr_reader :one_of + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackAzureVoiceId] This is the provider-specific ID that will be used. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param one_of [Object] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackAzureVoice] + def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, one_of: OMIT, additional_properties: nil) + @voice_id = voice_id + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @one_of = one_of if one_of != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "speed": speed, + "chunkPlan": chunk_plan, + "oneOf": one_of + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackAzureVoice + # + # @param json_object [String] + # @return [Vapi::FallbackAzureVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackAzureVoiceId.from_json(json_object: voice_id) + end + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + one_of = parsed_json["oneOf"] + new( + voice_id: voice_id, + speed: speed, + chunk_plan: chunk_plan, + one_of: one_of, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackAzureVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackAzureVoiceId.validate_raw(obj: obj.voice_id) + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.one_of&.is_a?(Object) != false || raise("Passed value for field obj.one_of is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_azure_voice_id.rb b/lib/vapi_server_sdk/types/fallback_azure_voice_id.rb new file mode 100644 index 0000000..0e91c2f --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_azure_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackAzureVoiceId + # Deserialize a JSON object to an instance of FallbackAzureVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackAzureVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackAzureVoiceVoiceId) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackAzureVoiceVoiceId) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_azure_voice_voice_id.rb b/lib/vapi_server_sdk/types/fallback_azure_voice_voice_id.rb new file mode 100644 index 0000000..26bf573 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_azure_voice_voice_id.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + class FallbackAzureVoiceVoiceId + ANDREW = "andrew" + BRIAN = "brian" + EMMA = "emma" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb b/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb new file mode 100644 index 0000000..8e48713 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +require_relative "fallback_cartesia_voice_model" +require_relative "fallback_cartesia_voice_language" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackCartesiaVoice + # @return [Vapi::FallbackCartesiaVoiceModel] This is the model that will be used. This is optional and will default to the + # correct model for the voiceId. + attr_reader :model + # @return [Vapi::FallbackCartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the + # correct language for the voiceId. + attr_reader :language + # @return [String] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param model [Vapi::FallbackCartesiaVoiceModel] This is the model that will be used. This is optional and will default to the + # correct model for the voiceId. + # @param language [Vapi::FallbackCartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the + # correct language for the voiceId. + # @param voice_id [String] This is the provider-specific ID that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackCartesiaVoice] + def initialize(voice_id:, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) + @model = model if model != OMIT + @language = language if language != OMIT + @voice_id = voice_id + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "model": model, + "language": language, + "voiceId": voice_id, + "chunkPlan": chunk_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackCartesiaVoice + # + # @param json_object [String] + # @return [Vapi::FallbackCartesiaVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + model = parsed_json["model"] + language = parsed_json["language"] + voice_id = parsed_json["voiceId"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + model: model, + language: language, + voice_id: voice_id, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackCartesiaVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.model&.is_a?(Vapi::FallbackCartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.language&.is_a?(Vapi::FallbackCartesiaVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_cartesia_voice_language.rb b/lib/vapi_server_sdk/types/fallback_cartesia_voice_language.rb new file mode 100644 index 0000000..718e559 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_cartesia_voice_language.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Vapi + # This is the language that will be used. This is optional and will default to the + # correct language for the voiceId. + class FallbackCartesiaVoiceLanguage + EN = "en" + DE = "de" + ES = "es" + FR = "fr" + JA = "ja" + PT = "pt" + ZH = "zh" + HI = "hi" + IT = "it" + KO = "ko" + NL = "nl" + PL = "pl" + RU = "ru" + SV = "sv" + TR = "tr" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb b/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb new file mode 100644 index 0000000..462a8e4 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the model that will be used. This is optional and will default to the + # correct model for the voiceId. + class FallbackCartesiaVoiceModel + SONIC_ENGLISH = "sonic-english" + SONIC_MULTILINGUAL = "sonic-multilingual" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_custom_voice.rb b/lib/vapi_server_sdk/types/fallback_custom_voice.rb new file mode 100644 index 0000000..8b5516a --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_custom_voice.rb @@ -0,0 +1,117 @@ +# frozen_string_literal: true + +require_relative "server" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackCustomVoice + # @return [Vapi::Server] This is where the voice request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "message": { + # "type": "voice-request", + # "text": "Hello, world!", + # "sampleRate": 24000, + # ...other metadata about the call... + # } + # } + # Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified + # in the request. Here is how the response will be piped to the transport: + # ``` + # response.on('data', (chunk: Buffer) => { + # outputStream.write(chunk); + # }); + # ``` + attr_reader :server + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param server [Vapi::Server] This is where the voice request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "message": { + # "type": "voice-request", + # "text": "Hello, world!", + # "sampleRate": 24000, + # ...other metadata about the call... + # } + # } + # Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified + # in the request. Here is how the response will be piped to the transport: + # ``` + # response.on('data', (chunk: Buffer) => { + # outputStream.write(chunk); + # }); + # ``` + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackCustomVoice] + def initialize(server:, chunk_plan: OMIT, additional_properties: nil) + @server = server + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "server": server, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackCustomVoice + # + # @param json_object [String] + # @return [Vapi::FallbackCustomVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + server: server, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackCustomVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::Server.validate_raw(obj: obj.server) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb b/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb new file mode 100644 index 0000000..11f0051 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +require_relative "fallback_deepgram_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackDeepgramVoice + # @return [Vapi::FallbackDeepgramVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackDeepgramVoiceId] This is the provider-specific ID that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackDeepgramVoice] + def initialize(voice_id:, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackDeepgramVoice + # + # @param json_object [String] + # @return [Vapi::FallbackDeepgramVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackDeepgramVoiceId.from_json(json_object: voice_id) + end + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackDeepgramVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackDeepgramVoiceId.validate_raw(obj: obj.voice_id) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_deepgram_voice_id.rb b/lib/vapi_server_sdk/types/fallback_deepgram_voice_id.rb new file mode 100644 index 0000000..9d0d5d3 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_deepgram_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackDeepgramVoiceId + # Deserialize a JSON object to an instance of FallbackDeepgramVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackDeepgramVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackDeepgramVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackDeepgramVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_deepgram_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_deepgram_voice_id_enum.rb new file mode 100644 index 0000000..3da4b84 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_deepgram_voice_id_enum.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Vapi + class FallbackDeepgramVoiceIdEnum + ASTERIA = "asteria" + LUNA = "luna" + STELLA = "stella" + ATHENA = "athena" + HERA = "hera" + ORION = "orion" + ARCAS = "arcas" + PERSEUS = "perseus" + ANGUS = "angus" + ORPHEUS = "orpheus" + HELIOS = "helios" + ZEUS = "zeus" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb new file mode 100644 index 0000000..c03b6c2 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb @@ -0,0 +1,164 @@ +# frozen_string_literal: true + +require_relative "fallback_eleven_labs_voice_id" +require_relative "fallback_eleven_labs_voice_model" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackElevenLabsVoice + # @return [Vapi::FallbackElevenLabsVoiceId] This is the provider-specific ID that will be used. Ensure the Voice is present + # in your 11Labs Voice Library. + attr_reader :voice_id + # @return [Float] Defines the stability for voice settings. + attr_reader :stability + # @return [Float] Defines the similarity boost for voice settings. + attr_reader :similarity_boost + # @return [Float] Defines the style for voice settings. + attr_reader :style + # @return [Boolean] Defines the use speaker boost for voice settings. + attr_reader :use_speaker_boost + # @return [Float] Defines the optimize streaming latency for voice settings. Defaults to 3. + attr_reader :optimize_streaming_latency + # @return [Boolean] This enables the use of + # https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to + # false to save latency. + # @default false + attr_reader :enable_ssml_parsing + # @return [Vapi::FallbackElevenLabsVoiceModel] This is the model that will be used. Defaults to 'eleven_turbo_v2' if not + # specified. + attr_reader :model + # @return [String] This is the language (ISO 639-1) that is enforced for the model. Currently only + # Turbo v2.5 supports language enforcement. For other models, an error will be + # returned if language code is provided. + attr_reader :language + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackElevenLabsVoiceId] This is the provider-specific ID that will be used. Ensure the Voice is present + # in your 11Labs Voice Library. + # @param stability [Float] Defines the stability for voice settings. + # @param similarity_boost [Float] Defines the similarity boost for voice settings. + # @param style [Float] Defines the style for voice settings. + # @param use_speaker_boost [Boolean] Defines the use speaker boost for voice settings. + # @param optimize_streaming_latency [Float] Defines the optimize streaming latency for voice settings. Defaults to 3. + # @param enable_ssml_parsing [Boolean] This enables the use of + # https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to + # false to save latency. + # @default false + # @param model [Vapi::FallbackElevenLabsVoiceModel] This is the model that will be used. Defaults to 'eleven_turbo_v2' if not + # specified. + # @param language [String] This is the language (ISO 639-1) that is enforced for the model. Currently only + # Turbo v2.5 supports language enforcement. For other models, an error will be + # returned if language code is provided. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackElevenLabsVoice] + def initialize(voice_id:, stability: OMIT, similarity_boost: OMIT, style: OMIT, use_speaker_boost: OMIT, + optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @stability = stability if stability != OMIT + @similarity_boost = similarity_boost if similarity_boost != OMIT + @style = style if style != OMIT + @use_speaker_boost = use_speaker_boost if use_speaker_boost != OMIT + @optimize_streaming_latency = optimize_streaming_latency if optimize_streaming_latency != OMIT + @enable_ssml_parsing = enable_ssml_parsing if enable_ssml_parsing != OMIT + @model = model if model != OMIT + @language = language if language != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "stability": stability, + "similarityBoost": similarity_boost, + "style": style, + "useSpeakerBoost": use_speaker_boost, + "optimizeStreamingLatency": optimize_streaming_latency, + "enableSsmlParsing": enable_ssml_parsing, + "model": model, + "language": language, + "chunkPlan": chunk_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackElevenLabsVoice + # + # @param json_object [String] + # @return [Vapi::FallbackElevenLabsVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackElevenLabsVoiceId.from_json(json_object: voice_id) + end + stability = parsed_json["stability"] + similarity_boost = parsed_json["similarityBoost"] + style = parsed_json["style"] + use_speaker_boost = parsed_json["useSpeakerBoost"] + optimize_streaming_latency = parsed_json["optimizeStreamingLatency"] + enable_ssml_parsing = parsed_json["enableSsmlParsing"] + model = parsed_json["model"] + language = parsed_json["language"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + stability: stability, + similarity_boost: similarity_boost, + style: style, + use_speaker_boost: use_speaker_boost, + optimize_streaming_latency: optimize_streaming_latency, + enable_ssml_parsing: enable_ssml_parsing, + model: model, + language: language, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackElevenLabsVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackElevenLabsVoiceId.validate_raw(obj: obj.voice_id) + obj.stability&.is_a?(Float) != false || raise("Passed value for field obj.stability is not the expected type, validation failed.") + obj.similarity_boost&.is_a?(Float) != false || raise("Passed value for field obj.similarity_boost is not the expected type, validation failed.") + obj.style&.is_a?(Float) != false || raise("Passed value for field obj.style is not the expected type, validation failed.") + obj.use_speaker_boost&.is_a?(Boolean) != false || raise("Passed value for field obj.use_speaker_boost is not the expected type, validation failed.") + obj.optimize_streaming_latency&.is_a?(Float) != false || raise("Passed value for field obj.optimize_streaming_latency is not the expected type, validation failed.") + obj.enable_ssml_parsing&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_ssml_parsing is not the expected type, validation failed.") + obj.model&.is_a?(Vapi::FallbackElevenLabsVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id.rb b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id.rb new file mode 100644 index 0000000..132626e --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. Ensure the Voice is present + # in your 11Labs Voice Library. + class FallbackElevenLabsVoiceId + # Deserialize a JSON object to an instance of FallbackElevenLabsVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackElevenLabsVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackElevenLabsVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackElevenLabsVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id_enum.rb new file mode 100644 index 0000000..a073428 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_id_enum.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Vapi + class FallbackElevenLabsVoiceIdEnum + BURT = "burt" + MARISSA = "marissa" + ANDREA = "andrea" + SARAH = "sarah" + PHILLIP = "phillip" + STEVE = "steve" + JOSEPH = "joseph" + MYRA = "myra" + PAULA = "paula" + RYAN = "ryan" + DREW = "drew" + PAUL = "paul" + MRB = "mrb" + MATILDA = "matilda" + MARK = "mark" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb new file mode 100644 index 0000000..31e38bd --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Vapi + # This is the model that will be used. Defaults to 'eleven_turbo_v2' if not + # specified. + class FallbackElevenLabsVoiceModel + ELEVEN_MULTILINGUAL_V_2 = "eleven_multilingual_v2" + ELEVEN_TURBO_V_2 = "eleven_turbo_v2" + ELEVEN_TURBO_V_2_5 = "eleven_turbo_v2_5" + ELEVEN_MONOLINGUAL_V_1 = "eleven_monolingual_v1" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_lmnt_voice.rb b/lib/vapi_server_sdk/types/fallback_lmnt_voice.rb new file mode 100644 index 0000000..2a8fd43 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_lmnt_voice.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require_relative "fallback_lmnt_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackLmntVoice + # @return [Vapi::FallbackLmntVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackLmntVoiceId] This is the provider-specific ID that will be used. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackLmntVoice] + def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "speed": speed, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackLmntVoice + # + # @param json_object [String] + # @return [Vapi::FallbackLmntVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackLmntVoiceId.from_json(json_object: voice_id) + end + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + speed: speed, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackLmntVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackLmntVoiceId.validate_raw(obj: obj.voice_id) + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_lmnt_voice_id.rb b/lib/vapi_server_sdk/types/fallback_lmnt_voice_id.rb new file mode 100644 index 0000000..ac6eaa3 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_lmnt_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackLmntVoiceId + # Deserialize a JSON object to an instance of FallbackLmntVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackLmntVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackLmntVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackLmntVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_lmnt_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_lmnt_voice_id_enum.rb new file mode 100644 index 0000000..05f3a27 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_lmnt_voice_id_enum.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Vapi + class FallbackLmntVoiceIdEnum + LILY = "lily" + DANIEL = "daniel" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_neets_voice.rb b/lib/vapi_server_sdk/types/fallback_neets_voice.rb new file mode 100644 index 0000000..bde7b39 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_neets_voice.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +require_relative "fallback_neets_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackNeetsVoice + # @return [Vapi::FallbackNeetsVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackNeetsVoiceId] This is the provider-specific ID that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackNeetsVoice] + def initialize(voice_id:, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackNeetsVoice + # + # @param json_object [String] + # @return [Vapi::FallbackNeetsVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackNeetsVoiceId.from_json(json_object: voice_id) + end + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackNeetsVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackNeetsVoiceId.validate_raw(obj: obj.voice_id) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_neets_voice_id.rb b/lib/vapi_server_sdk/types/fallback_neets_voice_id.rb new file mode 100644 index 0000000..3439454 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_neets_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackNeetsVoiceId + # Deserialize a JSON object to an instance of FallbackNeetsVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackNeetsVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackNeetsVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackNeetsVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_neets_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_neets_voice_id_enum.rb new file mode 100644 index 0000000..cb9adcd --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_neets_voice_id_enum.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Vapi + class FallbackNeetsVoiceIdEnum + VITS = "vits" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb b/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb new file mode 100644 index 0000000..3fa63ae --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +require_relative "fallback_open_ai_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackOpenAiVoice + # @return [Vapi::FallbackOpenAiVoiceId] This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. + attr_reader :voice_id + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackOpenAiVoiceId] This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackOpenAiVoice] + def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "speed": speed, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackOpenAiVoice + # + # @param json_object [String] + # @return [Vapi::FallbackOpenAiVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + voice_id = parsed_json["voiceId"] + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + speed: speed, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackOpenAiVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.voice_id.is_a?(Vapi::FallbackOpenAiVoiceId) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb b/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb new file mode 100644 index 0000000..1ea2fd5 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Vapi + # This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. + class FallbackOpenAiVoiceId + ALLOY = "alloy" + ECHO = "echo" + FABLE = "fable" + ONYX = "onyx" + NOVA = "nova" + SHIMMER = "shimmer" + ASH = "ash" + BALLAD = "ballad" + CORAL = "coral" + SAGE = "sage" + VERSE = "verse" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_plan.rb b/lib/vapi_server_sdk/types/fallback_plan.rb new file mode 100644 index 0000000..ac92b3b --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_plan.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require_relative "fallback_plan_voices_item" +require "ostruct" +require "json" + +module Vapi + class FallbackPlan + # @return [Array] This is the list of voices to fallback to in the event that the primary voice + # provider fails. + attr_reader :voices + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voices [Array] This is the list of voices to fallback to in the event that the primary voice + # provider fails. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackPlan] + def initialize(voices:, additional_properties: nil) + @voices = voices + @additional_properties = additional_properties + @_field_set = { "voices": voices } + end + + # Deserialize a JSON object to an instance of FallbackPlan + # + # @param json_object [String] + # @return [Vapi::FallbackPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + voices = parsed_json["voices"]&.map do |item| + item = item.to_json + Vapi::FallbackPlanVoicesItem.from_json(json_object: item) + end + new(voices: voices, additional_properties: struct) + end + + # Serialize an instance of FallbackPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.voices.is_a?(Array) != false || raise("Passed value for field obj.voices is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb b/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb new file mode 100644 index 0000000..f8a3a54 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb @@ -0,0 +1,211 @@ +# frozen_string_literal: true + +require "json" +require_relative "fallback_azure_voice" +require_relative "fallback_cartesia_voice" +require_relative "fallback_custom_voice" +require_relative "fallback_deepgram_voice" +require_relative "fallback_eleven_labs_voice" +require_relative "fallback_lmnt_voice" +require_relative "fallback_neets_voice" +require_relative "fallback_open_ai_voice" +require_relative "fallback_play_ht_voice" +require_relative "fallback_rime_ai_voice" +require_relative "fallback_tavus_voice" + +module Vapi + class FallbackPlanVoicesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::FallbackPlanVoicesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of FallbackPlanVoicesItem + # + # @param json_object [String] + # @return [Vapi::FallbackPlanVoicesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "azure" + Vapi::FallbackAzureVoice.from_json(json_object: json_object) + when "cartesia" + Vapi::FallbackCartesiaVoice.from_json(json_object: json_object) + when "custom-voice" + Vapi::FallbackCustomVoice.from_json(json_object: json_object) + when "deepgram" + Vapi::FallbackDeepgramVoice.from_json(json_object: json_object) + when "11labs" + Vapi::FallbackElevenLabsVoice.from_json(json_object: json_object) + when "lmnt" + Vapi::FallbackLmntVoice.from_json(json_object: json_object) + when "neets" + Vapi::FallbackNeetsVoice.from_json(json_object: json_object) + when "openai" + Vapi::FallbackOpenAiVoice.from_json(json_object: json_object) + when "playht" + Vapi::FallbackPlayHtVoice.from_json(json_object: json_object) + when "rime-ai" + Vapi::FallbackRimeAiVoice.from_json(json_object: json_object) + when "tavus" + Vapi::FallbackTavusVoice.from_json(json_object: json_object) + else + Vapi::FallbackAzureVoice.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "azure" + { **@member.to_json, provider: @discriminant }.to_json + when "cartesia" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-voice" + { **@member.to_json, provider: @discriminant }.to_json + when "deepgram" + { **@member.to_json, provider: @discriminant }.to_json + when "11labs" + { **@member.to_json, provider: @discriminant }.to_json + when "lmnt" + { **@member.to_json, provider: @discriminant }.to_json + when "neets" + { **@member.to_json, provider: @discriminant }.to_json + when "openai" + { **@member.to_json, provider: @discriminant }.to_json + when "playht" + { **@member.to_json, provider: @discriminant }.to_json + when "rime-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "azure" + Vapi::FallbackAzureVoice.validate_raw(obj: obj) + when "cartesia" + Vapi::FallbackCartesiaVoice.validate_raw(obj: obj) + when "custom-voice" + Vapi::FallbackCustomVoice.validate_raw(obj: obj) + when "deepgram" + Vapi::FallbackDeepgramVoice.validate_raw(obj: obj) + when "11labs" + Vapi::FallbackElevenLabsVoice.validate_raw(obj: obj) + when "lmnt" + Vapi::FallbackLmntVoice.validate_raw(obj: obj) + when "neets" + Vapi::FallbackNeetsVoice.validate_raw(obj: obj) + when "openai" + Vapi::FallbackOpenAiVoice.validate_raw(obj: obj) + when "playht" + Vapi::FallbackPlayHtVoice.validate_raw(obj: obj) + when "rime-ai" + Vapi::FallbackRimeAiVoice.validate_raw(obj: obj) + when "tavus" + Vapi::FallbackTavusVoice.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::FallbackAzureVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + + # @param member [Vapi::FallbackCartesiaVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.cartesia(member:) + new(member: member, discriminant: "cartesia") + end + + # @param member [Vapi::FallbackCustomVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.custom_voice(member:) + new(member: member, discriminant: "custom-voice") + end + + # @param member [Vapi::FallbackDeepgramVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.deepgram(member:) + new(member: member, discriminant: "deepgram") + end + + # @param member [Vapi::FallbackElevenLabsVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self._11_labs(member:) + new(member: member, discriminant: "11labs") + end + + # @param member [Vapi::FallbackLmntVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.lmnt(member:) + new(member: member, discriminant: "lmnt") + end + + # @param member [Vapi::FallbackNeetsVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.neets(member:) + new(member: member, discriminant: "neets") + end + + # @param member [Vapi::FallbackOpenAiVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.openai(member:) + new(member: member, discriminant: "openai") + end + + # @param member [Vapi::FallbackPlayHtVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.playht(member:) + new(member: member, discriminant: "playht") + end + + # @param member [Vapi::FallbackRimeAiVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.rime_ai(member:) + new(member: member, discriminant: "rime-ai") + end + + # @param member [Vapi::FallbackTavusVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice.rb new file mode 100644 index 0000000..09d12e7 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice.rb @@ -0,0 +1,172 @@ +# frozen_string_literal: true + +require_relative "fallback_play_ht_voice_id" +require_relative "fallback_play_ht_voice_emotion" +require_relative "fallback_play_ht_voice_model" +require_relative "fallback_play_ht_voice_language" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackPlayHtVoice + # @return [Vapi::FallbackPlayHtVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Float] A floating point number between 0, exclusive, and 2, inclusive. If equal to null + # or not provided, the model's default temperature will be used. The temperature + # parameter controls variance. Lower temperatures result in more predictable + # results, higher temperatures allow each run to vary more, so the voice may sound + # less like the baseline voice. + attr_reader :temperature + # @return [Vapi::FallbackPlayHtVoiceEmotion] An emotion to be applied to the speech. + attr_reader :emotion + # @return [Float] A number between 1 and 6. Use lower numbers to reduce how unique your chosen + # voice will be compared to other voices. + attr_reader :voice_guidance + # @return [Float] A number between 1 and 30. Use lower numbers to to reduce how strong your chosen + # emotion will be. Higher numbers will create a very emotional performance. + attr_reader :style_guidance + # @return [Float] A number between 1 and 2. This number influences how closely the generated + # speech adheres to the input text. Use lower values to create more fluid speech, + # but with a higher chance of deviating from the input text. Higher numbers will + # make the generated speech more accurate to the input text, ensuring that the + # words spoken align closely with the provided text. + attr_reader :text_guidance + # @return [Vapi::FallbackPlayHtVoiceModel] Playht voice model/engine to use. + attr_reader :model + # @return [Vapi::FallbackPlayHtVoiceLanguage] The language to use for the speech. + attr_reader :language + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackPlayHtVoiceId] This is the provider-specific ID that will be used. + # @param speed [Float] This is the speed multiplier that will be used. + # @param temperature [Float] A floating point number between 0, exclusive, and 2, inclusive. If equal to null + # or not provided, the model's default temperature will be used. The temperature + # parameter controls variance. Lower temperatures result in more predictable + # results, higher temperatures allow each run to vary more, so the voice may sound + # less like the baseline voice. + # @param emotion [Vapi::FallbackPlayHtVoiceEmotion] An emotion to be applied to the speech. + # @param voice_guidance [Float] A number between 1 and 6. Use lower numbers to reduce how unique your chosen + # voice will be compared to other voices. + # @param style_guidance [Float] A number between 1 and 30. Use lower numbers to to reduce how strong your chosen + # emotion will be. Higher numbers will create a very emotional performance. + # @param text_guidance [Float] A number between 1 and 2. This number influences how closely the generated + # speech adheres to the input text. Use lower values to create more fluid speech, + # but with a higher chance of deviating from the input text. Higher numbers will + # make the generated speech more accurate to the input text, ensuring that the + # words spoken align closely with the provided text. + # @param model [Vapi::FallbackPlayHtVoiceModel] Playht voice model/engine to use. + # @param language [Vapi::FallbackPlayHtVoiceLanguage] The language to use for the speech. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackPlayHtVoice] + def initialize(voice_id:, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, + style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @speed = speed if speed != OMIT + @temperature = temperature if temperature != OMIT + @emotion = emotion if emotion != OMIT + @voice_guidance = voice_guidance if voice_guidance != OMIT + @style_guidance = style_guidance if style_guidance != OMIT + @text_guidance = text_guidance if text_guidance != OMIT + @model = model if model != OMIT + @language = language if language != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "speed": speed, + "temperature": temperature, + "emotion": emotion, + "voiceGuidance": voice_guidance, + "styleGuidance": style_guidance, + "textGuidance": text_guidance, + "model": model, + "language": language, + "chunkPlan": chunk_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackPlayHtVoice + # + # @param json_object [String] + # @return [Vapi::FallbackPlayHtVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackPlayHtVoiceId.from_json(json_object: voice_id) + end + speed = parsed_json["speed"] + temperature = parsed_json["temperature"] + emotion = parsed_json["emotion"] + voice_guidance = parsed_json["voiceGuidance"] + style_guidance = parsed_json["styleGuidance"] + text_guidance = parsed_json["textGuidance"] + model = parsed_json["model"] + language = parsed_json["language"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + speed: speed, + temperature: temperature, + emotion: emotion, + voice_guidance: voice_guidance, + style_guidance: style_guidance, + text_guidance: text_guidance, + model: model, + language: language, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackPlayHtVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackPlayHtVoiceId.validate_raw(obj: obj.voice_id) + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") + obj.emotion&.is_a?(Vapi::FallbackPlayHtVoiceEmotion) != false || raise("Passed value for field obj.emotion is not the expected type, validation failed.") + obj.voice_guidance&.is_a?(Float) != false || raise("Passed value for field obj.voice_guidance is not the expected type, validation failed.") + obj.style_guidance&.is_a?(Float) != false || raise("Passed value for field obj.style_guidance is not the expected type, validation failed.") + obj.text_guidance&.is_a?(Float) != false || raise("Passed value for field obj.text_guidance is not the expected type, validation failed.") + obj.model&.is_a?(Vapi::FallbackPlayHtVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.language&.is_a?(Vapi::FallbackPlayHtVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice_emotion.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice_emotion.rb new file mode 100644 index 0000000..48d7c16 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice_emotion.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Vapi + # An emotion to be applied to the speech. + class FallbackPlayHtVoiceEmotion + FEMALE_HAPPY = "female_happy" + FEMALE_SAD = "female_sad" + FEMALE_ANGRY = "female_angry" + FEMALE_FEARFUL = "female_fearful" + FEMALE_DISGUST = "female_disgust" + FEMALE_SURPRISED = "female_surprised" + MALE_HAPPY = "male_happy" + MALE_SAD = "male_sad" + MALE_ANGRY = "male_angry" + MALE_FEARFUL = "male_fearful" + MALE_DISGUST = "male_disgust" + MALE_SURPRISED = "male_surprised" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice_id.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice_id.rb new file mode 100644 index 0000000..aa3dd11 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackPlayHtVoiceId + # Deserialize a JSON object to an instance of FallbackPlayHtVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackPlayHtVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackPlayHtVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackPlayHtVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice_id_enum.rb new file mode 100644 index 0000000..3c1b1d8 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice_id_enum.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Vapi + class FallbackPlayHtVoiceIdEnum + JENNIFER = "jennifer" + MELISSA = "melissa" + WILL = "will" + CHRIS = "chris" + MATT = "matt" + JACK = "jack" + RUBY = "ruby" + DAVIS = "davis" + DONNA = "donna" + MICHAEL = "michael" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice_language.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice_language.rb new file mode 100644 index 0000000..c5e222e --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice_language.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Vapi + # The language to use for the speech. + class FallbackPlayHtVoiceLanguage + AFRIKAANS = "afrikaans" + ALBANIAN = "albanian" + AMHARIC = "amharic" + ARABIC = "arabic" + BENGALI = "bengali" + BULGARIAN = "bulgarian" + CATALAN = "catalan" + CROATIAN = "croatian" + CZECH = "czech" + DANISH = "danish" + DUTCH = "dutch" + ENGLISH = "english" + FRENCH = "french" + GALICIAN = "galician" + GERMAN = "german" + GREEK = "greek" + HEBREW = "hebrew" + HINDI = "hindi" + HUNGARIAN = "hungarian" + INDONESIAN = "indonesian" + ITALIAN = "italian" + JAPANESE = "japanese" + KOREAN = "korean" + MALAY = "malay" + MANDARIN = "mandarin" + POLISH = "polish" + PORTUGUESE = "portuguese" + RUSSIAN = "russian" + SERBIAN = "serbian" + SPANISH = "spanish" + SWEDISH = "swedish" + TAGALOG = "tagalog" + THAI = "thai" + TURKISH = "turkish" + UKRAINIAN = "ukrainian" + URDU = "urdu" + XHOSA = "xhosa" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb b/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb new file mode 100644 index 0000000..d5ce109 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # Playht voice model/engine to use. + class FallbackPlayHtVoiceModel + PLAY_HT_20 = "PlayHT2.0" + PLAY_HT_20_TURBO = "PlayHT2.0-turbo" + PLAY_30_MINI = "Play3.0-mini" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_rime_ai_voice.rb b/lib/vapi_server_sdk/types/fallback_rime_ai_voice.rb new file mode 100644 index 0000000..652ba02 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_rime_ai_voice.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require_relative "fallback_rime_ai_voice_id" +require_relative "fallback_rime_ai_voice_model" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackRimeAiVoice + # @return [Vapi::FallbackRimeAiVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::FallbackRimeAiVoiceModel] This is the model that will be used. Defaults to 'v1' when not specified. + attr_reader :model + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackRimeAiVoiceId] This is the provider-specific ID that will be used. + # @param model [Vapi::FallbackRimeAiVoiceModel] This is the model that will be used. Defaults to 'v1' when not specified. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackRimeAiVoice] + def initialize(voice_id:, model: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @model = model if model != OMIT + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "model": model, "speed": speed, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackRimeAiVoice + # + # @param json_object [String] + # @return [Vapi::FallbackRimeAiVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackRimeAiVoiceId.from_json(json_object: voice_id) + end + model = parsed_json["model"] + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + model: model, + speed: speed, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackRimeAiVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackRimeAiVoiceId.validate_raw(obj: obj.voice_id) + obj.model&.is_a?(Vapi::FallbackRimeAiVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id.rb b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id.rb new file mode 100644 index 0000000..615f58a --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackRimeAiVoiceId + # Deserialize a JSON object to an instance of FallbackRimeAiVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackRimeAiVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackRimeAiVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackRimeAiVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb new file mode 100644 index 0000000..b49f9de --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module Vapi + class FallbackRimeAiVoiceIdEnum + MARSH = "marsh" + BAYOU = "bayou" + CREEK = "creek" + BROOK = "brook" + FLOWER = "flower" + SPORE = "spore" + GLACIER = "glacier" + GULCH = "gulch" + ALPINE = "alpine" + COVE = "cove" + LAGOON = "lagoon" + TUNDRA = "tundra" + STEPPE = "steppe" + MESA = "mesa" + GROVE = "grove" + RAINFOREST = "rainforest" + MORAINE = "moraine" + WILDFLOWER = "wildflower" + PEAK = "peak" + BOULDER = "boulder" + ABBIE = "abbie" + ALLISON = "allison" + ALLY = "ally" + ALONA = "alona" + AMBER = "amber" + ANA = "ana" + ANTOINE = "antoine" + ARMON = "armon" + BRENDA = "brenda" + BRITTANY = "brittany" + CAROL = "carol" + COLIN = "colin" + COURTNEY = "courtney" + ELENA = "elena" + ELLIOT = "elliot" + EVA = "eva" + GEOFF = "geoff" + GERALD = "gerald" + HANK = "hank" + HELEN = "helen" + HERA = "hera" + JEN = "jen" + JOE = "joe" + JOY = "joy" + JUAN = "juan" + KENDRA = "kendra" + KENDRICK = "kendrick" + KENNETH = "kenneth" + KEVIN = "kevin" + KRIS = "kris" + LINDA = "linda" + MADISON = "madison" + MARGE = "marge" + MARINA = "marina" + MARISSA = "marissa" + MARTA = "marta" + MAYA = "maya" + NICHOLAS = "nicholas" + NYLES = "nyles" + PHIL = "phil" + REBA = "reba" + REX = "rex" + RICK = "rick" + RITU = "ritu" + ROB = "rob" + RODNEY = "rodney" + ROHAN = "rohan" + ROSCO = "rosco" + SAMANTHA = "samantha" + SANDY = "sandy" + SELENA = "selena" + SETH = "seth" + SHARON = "sharon" + STAN = "stan" + TAMRA = "tamra" + TANYA = "tanya" + TIBUR = "tibur" + TJ = "tj" + TYLER = "tyler" + VIV = "viv" + YADIRA = "yadira" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb new file mode 100644 index 0000000..253cdf9 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the model that will be used. Defaults to 'v1' when not specified. + class FallbackRimeAiVoiceModel + V_1 = "v1" + MIST = "mist" + end +end diff --git a/lib/vapi_server_sdk/types/fallback_tavus_voice.rb b/lib/vapi_server_sdk/types/fallback_tavus_voice.rb new file mode 100644 index 0000000..ce54b22 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_tavus_voice.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +require_relative "fallback_tavus_voice_voice_id" +require_relative "tavus_conversation_properties" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackTavusVoice + # @return [Vapi::FallbackTavusVoiceVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [String] This is the unique identifier for the persona that the replica will use in the + # conversation. + attr_reader :persona_id + # @return [String] This is the url that will receive webhooks with updates regarding the + # conversation state. + attr_reader :callback_url + # @return [String] This is the name for the conversation. + attr_reader :conversation_name + # @return [String] This is the context that will be appended to any context provided in the + # persona, if one is provided. + attr_reader :conversational_context + # @return [String] This is the custom greeting that the replica will give once a participant joines + # the conversation. + attr_reader :custom_greeting + # @return [Vapi::TavusConversationProperties] These are optional properties used to customize the conversation. + attr_reader :properties + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackTavusVoiceVoiceId] This is the provider-specific ID that will be used. + # @param persona_id [String] This is the unique identifier for the persona that the replica will use in the + # conversation. + # @param callback_url [String] This is the url that will receive webhooks with updates regarding the + # conversation state. + # @param conversation_name [String] This is the name for the conversation. + # @param conversational_context [String] This is the context that will be appended to any context provided in the + # persona, if one is provided. + # @param custom_greeting [String] This is the custom greeting that the replica will give once a participant joines + # the conversation. + # @param properties [Vapi::TavusConversationProperties] These are optional properties used to customize the conversation. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackTavusVoice] + def initialize(voice_id:, persona_id: OMIT, callback_url: OMIT, conversation_name: OMIT, + conversational_context: OMIT, custom_greeting: OMIT, properties: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @persona_id = persona_id if persona_id != OMIT + @callback_url = callback_url if callback_url != OMIT + @conversation_name = conversation_name if conversation_name != OMIT + @conversational_context = conversational_context if conversational_context != OMIT + @custom_greeting = custom_greeting if custom_greeting != OMIT + @properties = properties if properties != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "personaId": persona_id, + "callbackUrl": callback_url, + "conversationName": conversation_name, + "conversationalContext": conversational_context, + "customGreeting": custom_greeting, + "properties": properties, + "chunkPlan": chunk_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackTavusVoice + # + # @param json_object [String] + # @return [Vapi::FallbackTavusVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackTavusVoiceVoiceId.from_json(json_object: voice_id) + end + persona_id = parsed_json["personaId"] + callback_url = parsed_json["callbackUrl"] + conversation_name = parsed_json["conversationName"] + conversational_context = parsed_json["conversationalContext"] + custom_greeting = parsed_json["customGreeting"] + if parsed_json["properties"].nil? + properties = nil + else + properties = parsed_json["properties"].to_json + properties = Vapi::TavusConversationProperties.from_json(json_object: properties) + end + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + persona_id: persona_id, + callback_url: callback_url, + conversation_name: conversation_name, + conversational_context: conversational_context, + custom_greeting: custom_greeting, + properties: properties, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackTavusVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackTavusVoiceVoiceId.validate_raw(obj: obj.voice_id) + obj.persona_id&.is_a?(String) != false || raise("Passed value for field obj.persona_id is not the expected type, validation failed.") + obj.callback_url&.is_a?(String) != false || raise("Passed value for field obj.callback_url is not the expected type, validation failed.") + obj.conversation_name&.is_a?(String) != false || raise("Passed value for field obj.conversation_name is not the expected type, validation failed.") + obj.conversational_context&.is_a?(String) != false || raise("Passed value for field obj.conversational_context is not the expected type, validation failed.") + obj.custom_greeting&.is_a?(String) != false || raise("Passed value for field obj.custom_greeting is not the expected type, validation failed.") + obj.properties.nil? || Vapi::TavusConversationProperties.validate_raw(obj: obj.properties) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_tavus_voice_voice_id.rb b/lib/vapi_server_sdk/types/fallback_tavus_voice_voice_id.rb new file mode 100644 index 0000000..f27c1a2 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_tavus_voice_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackTavusVoiceVoiceId + # Deserialize a JSON object to an instance of FallbackTavusVoiceVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackTavusVoiceVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/format_plan.rb b/lib/vapi_server_sdk/types/format_plan.rb index e6b8dd7..a806fce 100644 --- a/lib/vapi_server_sdk/types/format_plan.rb +++ b/lib/vapi_server_sdk/types/format_plan.rb @@ -11,7 +11,6 @@ class FormatPlan # addresses. Default `true`. # Usage: # - To rely on the voice provider's formatting logic, set this to `false`. - # - To use ElevenLabs's `enableSsmlParsing` feature, set this to `false`. # If `voice.chunkPlan.enabled` is `false`, this is automatically `false` since # there's no chunk to format. # @default true @@ -49,7 +48,6 @@ class FormatPlan # addresses. Default `true`. # Usage: # - To rely on the voice provider's formatting logic, set this to `false`. - # - To use ElevenLabs's `enableSsmlParsing` feature, set this to `false`. # If `voice.chunkPlan.enabled` is `false`, this is automatically `false` since # there's no chunk to format. # @default true diff --git a/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb b/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb index e4043d1..046c2a2 100644 --- a/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +++ b/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb @@ -21,6 +21,8 @@ class FunctionToolWithToolCall # `tool.destinations`. For others like the function tool, these can be custom # configured. attr_reader :messages + # @return [String] The type of tool. "function" for Function tool. + attr_reader :type # @return [Vapi::ToolCall] attr_reader :tool_call # @return [Vapi::OpenAiFunction] This is the function definition of the tool. @@ -58,6 +60,7 @@ class FunctionToolWithToolCall # For some tools, this is auto-filled based on special fields like # `tool.destinations`. For others like the function tool, these can be custom # configured. + # @param type [String] The type of tool. "function" for Function tool. # @param tool_call [Vapi::ToolCall] # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on @@ -76,9 +79,11 @@ class FunctionToolWithToolCall # phoneNumber.serverUrl, then org.serverUrl. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::FunctionToolWithToolCall] - def initialize(tool_call:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + def initialize(type:, tool_call:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, + additional_properties: nil) @async = async if async != OMIT @messages = messages if messages != OMIT + @type = type @tool_call = tool_call @function = function if function != OMIT @server = server if server != OMIT @@ -86,6 +91,7 @@ def initialize(tool_call:, async: OMIT, messages: OMIT, function: OMIT, server: @_field_set = { "async": async, "messages": messages, + "type": type, "toolCall": tool_call, "function": function, "server": server @@ -106,6 +112,7 @@ def self.from_json(json_object:) item = item.to_json Vapi::FunctionToolWithToolCallMessagesItem.from_json(json_object: item) end + type = parsed_json["type"] if parsed_json["toolCall"].nil? tool_call = nil else @@ -127,6 +134,7 @@ def self.from_json(json_object:) new( async: async, messages: messages, + type: type, tool_call: tool_call, function: function, server: server, @@ -150,6 +158,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") Vapi::ToolCall.validate_raw(obj: obj.tool_call) obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) diff --git a/lib/vapi_server_sdk/types/gcp_credential.rb b/lib/vapi_server_sdk/types/gcp_credential.rb index 70385e6..dae1863 100644 --- a/lib/vapi_server_sdk/types/gcp_credential.rb +++ b/lib/vapi_server_sdk/types/gcp_credential.rb @@ -18,7 +18,7 @@ class GcpCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at - # @return [String] This is the name of the GCP credential. This is just for your reference. + # @return [String] This is the name of credential. This is just for your reference. attr_reader :name # @return [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at @@ -40,7 +40,7 @@ class GcpCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. - # @param name [String] This is the name of the GCP credential. This is just for your reference. + # @param name [String] This is the name of credential. This is just for your reference. # @param gcp_key [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. diff --git a/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb b/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb index 0f56bd9..18e828a 100644 --- a/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +++ b/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb @@ -22,6 +22,8 @@ class GhlToolWithToolCall # `tool.destinations`. For others like the function tool, these can be custom # configured. attr_reader :messages + # @return [String] The type of tool. "ghl" for GHL tool. + attr_reader :type # @return [Vapi::ToolCall] attr_reader :tool_call # @return [Vapi::GhlToolMetadata] @@ -61,6 +63,7 @@ class GhlToolWithToolCall # For some tools, this is auto-filled based on special fields like # `tool.destinations`. For others like the function tool, these can be custom # configured. + # @param type [String] The type of tool. "ghl" for GHL tool. # @param tool_call [Vapi::ToolCall] # @param metadata [Vapi::GhlToolMetadata] # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. @@ -80,10 +83,11 @@ class GhlToolWithToolCall # phoneNumber.serverUrl, then org.serverUrl. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GhlToolWithToolCall] - def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, + def initialize(type:, tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) @async = async if async != OMIT @messages = messages if messages != OMIT + @type = type @tool_call = tool_call @metadata = metadata @function = function if function != OMIT @@ -92,6 +96,7 @@ def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMI @_field_set = { "async": async, "messages": messages, + "type": type, "toolCall": tool_call, "metadata": metadata, "function": function, @@ -113,6 +118,7 @@ def self.from_json(json_object:) item = item.to_json Vapi::GhlToolWithToolCallMessagesItem.from_json(json_object: item) end + type = parsed_json["type"] if parsed_json["toolCall"].nil? tool_call = nil else @@ -140,6 +146,7 @@ def self.from_json(json_object:) new( async: async, messages: messages, + type: type, tool_call: tool_call, metadata: metadata, function: function, @@ -164,6 +171,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") Vapi::ToolCall.validate_raw(obj: obj.tool_call) Vapi::GhlToolMetadata.validate_raw(obj: obj.metadata) obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) diff --git a/lib/vapi_server_sdk/types/gladia_credential.rb b/lib/vapi_server_sdk/types/gladia_credential.rb index 64ed025..44fc5ac 100644 --- a/lib/vapi_server_sdk/types/gladia_credential.rb +++ b/lib/vapi_server_sdk/types/gladia_credential.rb @@ -18,6 +18,8 @@ class GladiaCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class GladiaCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GladiaCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of GladiaCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/go_high_level_credential.rb b/lib/vapi_server_sdk/types/go_high_level_credential.rb index 24ae6a7..1224f0c 100644 --- a/lib/vapi_server_sdk/types/go_high_level_credential.rb +++ b/lib/vapi_server_sdk/types/go_high_level_credential.rb @@ -18,6 +18,8 @@ class GoHighLevelCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class GoHighLevelCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GoHighLevelCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of GoHighLevelCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/google_credential.rb b/lib/vapi_server_sdk/types/google_credential.rb new file mode 100644 index 0000000..71b9f59 --- /dev/null +++ b/lib/vapi_server_sdk/types/google_credential.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class GoogleCredential + # @return [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GoogleCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of GoogleCredential + # + # @param json_object [String] + # @return [Vapi::GoogleCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of GoogleCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/google_model.rb b/lib/vapi_server_sdk/types/google_model.rb new file mode 100644 index 0000000..c2f7a2e --- /dev/null +++ b/lib/vapi_server_sdk/types/google_model.rb @@ -0,0 +1,178 @@ +# frozen_string_literal: true + +require_relative "open_ai_message" +require_relative "google_model_tools_item" +require_relative "create_custom_knowledge_base_dto" +require_relative "google_model_model" +require "ostruct" +require "json" + +module Vapi + class GoogleModel + # @return [Array] This is the starting state for the conversation. + attr_reader :messages + # @return [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tools + # @return [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id + # @return [Vapi::GoogleModelModel] This is the Google model that will be used. + attr_reader :model + # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + attr_reader :temperature + # @return [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + attr_reader :max_tokens + # @return [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + attr_reader :emotion_recognition_enabled + # @return [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + attr_reader :num_fast_turns + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] This is the starting state for the conversation. + # @param tools [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. + # @param model [Vapi::GoogleModelModel] This is the Google model that will be used. + # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + # @param num_fast_turns [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GoogleModel] + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + @messages = messages if messages != OMIT + @tools = tools if tools != OMIT + @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT + @model = model + @temperature = temperature if temperature != OMIT + @max_tokens = max_tokens if max_tokens != OMIT + @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT + @num_fast_turns = num_fast_turns if num_fast_turns != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "tools": tools, + "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, + "model": model, + "temperature": temperature, + "maxTokens": max_tokens, + "emotionRecognitionEnabled": emotion_recognition_enabled, + "numFastTurns": num_fast_turns + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of GoogleModel + # + # @param json_object [String] + # @return [Vapi::GoogleModel] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + tools = parsed_json["tools"]&.map do |item| + item = item.to_json + Vapi::GoogleModelToolsItem.from_json(json_object: item) + end + tool_ids = parsed_json["toolIds"] + if parsed_json["knowledgeBase"].nil? + knowledge_base = nil + else + knowledge_base = parsed_json["knowledgeBase"].to_json + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) + end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] + max_tokens = parsed_json["maxTokens"] + emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] + num_fast_turns = parsed_json["numFastTurns"] + new( + messages: messages, + tools: tools, + tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, + model: model, + temperature: temperature, + max_tokens: max_tokens, + emotion_recognition_enabled: emotion_recognition_enabled, + num_fast_turns: num_fast_turns, + additional_properties: struct + ) + end + + # Serialize an instance of GoogleModel to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") + obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") + obj.model.is_a?(Vapi::GoogleModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") + obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") + obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") + obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/google_model_model.rb b/lib/vapi_server_sdk/types/google_model_model.rb new file mode 100644 index 0000000..01025ad --- /dev/null +++ b/lib/vapi_server_sdk/types/google_model_model.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Vapi + # This is the Google model that will be used. + class GoogleModelModel + GEMINI_15_FLASH = "gemini-1.5-flash" + GEMINI_15_FLASH_002 = "gemini-1.5-flash-002" + GEMINI_15_PRO = "gemini-1.5-pro" + GEMINI_15_PRO_002 = "gemini-1.5-pro-002" + GEMINI_10_PRO = "gemini-1.0-pro" + end +end diff --git a/lib/vapi_server_sdk/types/google_model_tools_item.rb b/lib/vapi_server_sdk/types/google_model_tools_item.rb new file mode 100644 index 0000000..0026456 --- /dev/null +++ b/lib/vapi_server_sdk/types/google_model_tools_item.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_dtmf_tool_dto" +require_relative "create_end_call_tool_dto" +require_relative "create_voicemail_tool_dto" +require_relative "create_function_tool_dto" +require_relative "create_ghl_tool_dto" +require_relative "create_make_tool_dto" +require_relative "create_transfer_call_tool_dto" + +module Vapi + class GoogleModelToolsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::GoogleModelToolsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of GoogleModelToolsItem + # + # @param json_object [String] + # @return [Vapi::GoogleModelToolsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::CreateEndCallToolDto.from_json(json_object: json_object) + when "voicemail" + Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) + when "function" + Vapi::CreateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::CreateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) + else + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "voicemail" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::CreateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::CreateEndCallToolDto.validate_raw(obj: obj) + when "voicemail" + Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) + when "function" + Vapi::CreateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::CreateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateDtmfToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::CreateEndCallToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::CreateVoicemailToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.voicemail(member:) + new(member: member, discriminant: "voicemail") + end + + # @param member [Vapi::CreateFunctionToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::CreateGhlToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::CreateMakeToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateTransferCallToolDto] + # @return [Vapi::GoogleModelToolsItem] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + end +end diff --git a/lib/vapi_server_sdk/types/groq_credential.rb b/lib/vapi_server_sdk/types/groq_credential.rb index 130068d..fa56c59 100644 --- a/lib/vapi_server_sdk/types/groq_credential.rb +++ b/lib/vapi_server_sdk/types/groq_credential.rb @@ -18,6 +18,8 @@ class GroqCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class GroqCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GroqCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of GroqCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/groq_model.rb b/lib/vapi_server_sdk/types/groq_model.rb index ba1f91f..eccde1a 100644 --- a/lib/vapi_server_sdk/types/groq_model.rb +++ b/lib/vapi_server_sdk/types/groq_model.rb @@ -2,8 +2,8 @@ require_relative "open_ai_message" require_relative "groq_model_tools_item" +require_relative "create_custom_knowledge_base_dto" require_relative "groq_model_model" -require_relative "knowledge_base" require "ostruct" require "json" @@ -19,13 +19,15 @@ class GroqModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [Vapi::GroqModelModel] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -56,10 +58,11 @@ class GroqModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [Vapi::GroqModelModel] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -74,14 +77,15 @@ class GroqModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GroqModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -90,9 +94,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -117,14 +122,15 @@ def self.from_json(json_object:) Vapi::GroqModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -132,9 +138,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -159,9 +166,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(Vapi::GroqModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/hipaa_buy_dto.rb b/lib/vapi_server_sdk/types/hipaa_buy_dto.rb new file mode 100644 index 0000000..96fddf3 --- /dev/null +++ b/lib/vapi_server_sdk/types/hipaa_buy_dto.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class HipaaBuyDto + # @return [String] This is the name of the recipient. + attr_reader :recipient_name + # @return [String] This is the name of the recipient organization. + attr_reader :recipient_organization + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param recipient_name [String] This is the name of the recipient. + # @param recipient_organization [String] This is the name of the recipient organization. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::HipaaBuyDto] + def initialize(recipient_name:, recipient_organization:, additional_properties: nil) + @recipient_name = recipient_name + @recipient_organization = recipient_organization + @additional_properties = additional_properties + @_field_set = { "recipientName": recipient_name, "recipientOrganization": recipient_organization } + end + + # Deserialize a JSON object to an instance of HipaaBuyDto + # + # @param json_object [String] + # @return [Vapi::HipaaBuyDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + recipient_name = parsed_json["recipientName"] + recipient_organization = parsed_json["recipientOrganization"] + new( + recipient_name: recipient_name, + recipient_organization: recipient_organization, + additional_properties: struct + ) + end + + # Serialize an instance of HipaaBuyDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.recipient_name.is_a?(String) != false || raise("Passed value for field obj.recipient_name is not the expected type, validation failed.") + obj.recipient_organization.is_a?(String) != false || raise("Passed value for field obj.recipient_organization is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/inflection_ai_credential.rb b/lib/vapi_server_sdk/types/inflection_ai_credential.rb new file mode 100644 index 0000000..ebf3ae1 --- /dev/null +++ b/lib/vapi_server_sdk/types/inflection_ai_credential.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class InflectionAiCredential + # @return [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::InflectionAiCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of InflectionAiCredential + # + # @param json_object [String] + # @return [Vapi::InflectionAiCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of InflectionAiCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/inflection_ai_model.rb b/lib/vapi_server_sdk/types/inflection_ai_model.rb new file mode 100644 index 0000000..9f8f469 --- /dev/null +++ b/lib/vapi_server_sdk/types/inflection_ai_model.rb @@ -0,0 +1,177 @@ +# frozen_string_literal: true + +require_relative "open_ai_message" +require_relative "inflection_ai_model_tools_item" +require_relative "create_custom_knowledge_base_dto" +require "ostruct" +require "json" + +module Vapi + class InflectionAiModel + # @return [Array] This is the starting state for the conversation. + attr_reader :messages + # @return [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tools + # @return [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id + # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + attr_reader :model + # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + attr_reader :temperature + # @return [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + attr_reader :max_tokens + # @return [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + attr_reader :emotion_recognition_enabled + # @return [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + attr_reader :num_fast_turns + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] This is the starting state for the conversation. + # @param tools [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. + # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + # @param num_fast_turns [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::InflectionAiModel] + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + @messages = messages if messages != OMIT + @tools = tools if tools != OMIT + @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT + @model = model + @temperature = temperature if temperature != OMIT + @max_tokens = max_tokens if max_tokens != OMIT + @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT + @num_fast_turns = num_fast_turns if num_fast_turns != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "tools": tools, + "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, + "model": model, + "temperature": temperature, + "maxTokens": max_tokens, + "emotionRecognitionEnabled": emotion_recognition_enabled, + "numFastTurns": num_fast_turns + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of InflectionAiModel + # + # @param json_object [String] + # @return [Vapi::InflectionAiModel] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + tools = parsed_json["tools"]&.map do |item| + item = item.to_json + Vapi::InflectionAiModelToolsItem.from_json(json_object: item) + end + tool_ids = parsed_json["toolIds"] + if parsed_json["knowledgeBase"].nil? + knowledge_base = nil + else + knowledge_base = parsed_json["knowledgeBase"].to_json + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) + end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] + max_tokens = parsed_json["maxTokens"] + emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] + num_fast_turns = parsed_json["numFastTurns"] + new( + messages: messages, + tools: tools, + tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, + model: model, + temperature: temperature, + max_tokens: max_tokens, + emotion_recognition_enabled: emotion_recognition_enabled, + num_fast_turns: num_fast_turns, + additional_properties: struct + ) + end + + # Serialize an instance of InflectionAiModel to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") + obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") + obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") + obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") + obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") + obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/inflection_ai_model_tools_item.rb b/lib/vapi_server_sdk/types/inflection_ai_model_tools_item.rb new file mode 100644 index 0000000..8c68684 --- /dev/null +++ b/lib/vapi_server_sdk/types/inflection_ai_model_tools_item.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_dtmf_tool_dto" +require_relative "create_end_call_tool_dto" +require_relative "create_voicemail_tool_dto" +require_relative "create_function_tool_dto" +require_relative "create_ghl_tool_dto" +require_relative "create_make_tool_dto" +require_relative "create_transfer_call_tool_dto" + +module Vapi + class InflectionAiModelToolsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::InflectionAiModelToolsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of InflectionAiModelToolsItem + # + # @param json_object [String] + # @return [Vapi::InflectionAiModelToolsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::CreateEndCallToolDto.from_json(json_object: json_object) + when "voicemail" + Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) + when "function" + Vapi::CreateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::CreateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) + else + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "voicemail" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::CreateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::CreateEndCallToolDto.validate_raw(obj: obj) + when "voicemail" + Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) + when "function" + Vapi::CreateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::CreateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateDtmfToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::CreateEndCallToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::CreateVoicemailToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.voicemail(member:) + new(member: member, discriminant: "voicemail") + end + + # @param member [Vapi::CreateFunctionToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::CreateGhlToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::CreateMakeToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateTransferCallToolDto] + # @return [Vapi::InflectionAiModelToolsItem] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + end +end diff --git a/lib/vapi_server_sdk/types/invite_user_dto.rb b/lib/vapi_server_sdk/types/invite_user_dto.rb index 7827123..4b139dd 100644 --- a/lib/vapi_server_sdk/types/invite_user_dto.rb +++ b/lib/vapi_server_sdk/types/invite_user_dto.rb @@ -6,8 +6,8 @@ module Vapi class InviteUserDto - # @return [String] - attr_reader :email + # @return [Array] + attr_reader :emails # @return [Vapi::InviteUserDtoRole] attr_reader :role # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -18,15 +18,15 @@ class InviteUserDto OMIT = Object.new - # @param email [String] + # @param emails [Array] # @param role [Vapi::InviteUserDtoRole] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::InviteUserDto] - def initialize(email:, role:, additional_properties: nil) - @email = email + def initialize(emails:, role:, additional_properties: nil) + @emails = emails @role = role @additional_properties = additional_properties - @_field_set = { "email": email, "role": role } + @_field_set = { "emails": emails, "role": role } end # Deserialize a JSON object to an instance of InviteUserDto @@ -36,10 +36,10 @@ def initialize(email:, role:, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - email = parsed_json["email"] + emails = parsed_json["emails"] role = parsed_json["role"] new( - email: email, + emails: emails, role: role, additional_properties: struct ) @@ -59,7 +59,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") + obj.emails.is_a?(Array) != false || raise("Passed value for field obj.emails is not the expected type, validation failed.") obj.role.is_a?(Vapi::InviteUserDtoRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/knowledge_base_response_document.rb b/lib/vapi_server_sdk/types/knowledge_base_response_document.rb new file mode 100644 index 0000000..248c8c5 --- /dev/null +++ b/lib/vapi_server_sdk/types/knowledge_base_response_document.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class KnowledgeBaseResponseDocument + # @return [String] This is the content of the document. + attr_reader :content + # @return [Float] This is the similarity score of the document. + attr_reader :similarity + # @return [String] This is the uuid of the document. + attr_reader :uuid + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param content [String] This is the content of the document. + # @param similarity [Float] This is the similarity score of the document. + # @param uuid [String] This is the uuid of the document. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::KnowledgeBaseResponseDocument] + def initialize(content:, similarity:, uuid: OMIT, additional_properties: nil) + @content = content + @similarity = similarity + @uuid = uuid if uuid != OMIT + @additional_properties = additional_properties + @_field_set = { "content": content, "similarity": similarity, "uuid": uuid }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of KnowledgeBaseResponseDocument + # + # @param json_object [String] + # @return [Vapi::KnowledgeBaseResponseDocument] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + content = parsed_json["content"] + similarity = parsed_json["similarity"] + uuid = parsed_json["uuid"] + new( + content: content, + similarity: similarity, + uuid: uuid, + additional_properties: struct + ) + end + + # Serialize an instance of KnowledgeBaseResponseDocument to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.similarity.is_a?(Float) != false || raise("Passed value for field obj.similarity is not the expected type, validation failed.") + obj.uuid&.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/langfuse_credential.rb b/lib/vapi_server_sdk/types/langfuse_credential.rb new file mode 100644 index 0000000..7afa255 --- /dev/null +++ b/lib/vapi_server_sdk/types/langfuse_credential.rb @@ -0,0 +1,130 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class LangfuseCredential + # @return [String] + attr_reader :provider + # @return [String] The public key for Langfuse project. Eg: pk-lf-... + attr_reader :public_key + # @return [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + attr_reader :api_key + # @return [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + attr_reader :api_url + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param public_key [String] The public key for Langfuse project. Eg: pk-lf-... + # @param api_key [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + # @param api_url [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::LangfuseCredential] + def initialize(provider:, public_key:, api_key:, api_url:, id:, org_id:, created_at:, updated_at:, name: OMIT, + additional_properties: nil) + @provider = provider + @public_key = public_key + @api_key = api_key + @api_url = api_url + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "publicKey": public_key, + "apiKey": api_key, + "apiUrl": api_url, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of LangfuseCredential + # + # @param json_object [String] + # @return [Vapi::LangfuseCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + public_key = parsed_json["publicKey"] + api_key = parsed_json["apiKey"] + api_url = parsed_json["apiUrl"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + public_key: public_key, + api_key: api_key, + api_url: api_url, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of LangfuseCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.public_key.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_url.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/lmnt_credential.rb b/lib/vapi_server_sdk/types/lmnt_credential.rb index 3b2e4a9..e43faa7 100644 --- a/lib/vapi_server_sdk/types/lmnt_credential.rb +++ b/lib/vapi_server_sdk/types/lmnt_credential.rb @@ -18,6 +18,8 @@ class LmntCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class LmntCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::LmntCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of LmntCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/lmnt_voice.rb b/lib/vapi_server_sdk/types/lmnt_voice.rb index b7e34ce..eabcdfc 100644 --- a/lib/vapi_server_sdk/types/lmnt_voice.rb +++ b/lib/vapi_server_sdk/types/lmnt_voice.rb @@ -2,15 +2,12 @@ require_relative "lmnt_voice_id" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class LmntVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::LmntVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id # @return [Float] This is the speed multiplier that will be used. @@ -18,6 +15,9 @@ class LmntVoice # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -26,26 +26,25 @@ class LmntVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::LmntVoiceId] This is the provider-specific ID that will be used. # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::LmntVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @speed = speed if speed != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, "speed": speed, - "chunkPlan": chunk_plan + "chunkPlan": chunk_plan, + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -58,7 +57,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_pla def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -72,11 +70,17 @@ def self.from_json(json_object:) chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, speed: speed, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -95,10 +99,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::LmntVoiceId.validate_raw(obj: obj.voice_id) obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/log.rb b/lib/vapi_server_sdk/types/log.rb index 73bd6db..a06b2c2 100644 --- a/lib/vapi_server_sdk/types/log.rb +++ b/lib/vapi_server_sdk/types/log.rb @@ -9,12 +9,14 @@ module Vapi class Log - # @return [Float] This is the timestamp at which the log was written. + # @return [String] This is the timestamp at which the log was written. attr_reader :time # @return [String] This is the unique identifier for the org that this log belongs to. attr_reader :org_id # @return [Vapi::LogType] This is the type of the log. attr_reader :type + # @return [String] This is the type of the webhook, given the log is from a webhook. + attr_reader :webhook_type # @return [Vapi::LogResource] This is the specific resource, relevant only to API logs. attr_reader :resource # @return [Float] 'This is how long the request took. @@ -63,9 +65,10 @@ class Log OMIT = Object.new - # @param time [Float] This is the timestamp at which the log was written. + # @param time [String] This is the timestamp at which the log was written. # @param org_id [String] This is the unique identifier for the org that this log belongs to. # @param type [Vapi::LogType] This is the type of the log. + # @param webhook_type [String] This is the type of the webhook, given the log is from a webhook. # @param resource [Vapi::LogResource] This is the specific resource, relevant only to API logs. # @param request_duration_seconds [Float] 'This is how long the request took. # @param request_started_at [String] This is the timestamp at which the request began. @@ -89,10 +92,11 @@ class Log # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Log] def initialize(time:, org_id:, type:, request_duration_seconds:, request_started_at:, request_finished_at:, - request_body:, request_http_method:, request_url:, request_path:, response_http_code:, resource: OMIT, request_query: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil) + request_body:, request_http_method:, request_url:, request_path:, response_http_code:, webhook_type: OMIT, resource: OMIT, request_query: OMIT, request_ip_address: OMIT, request_origin: OMIT, response_body: OMIT, request_headers: OMIT, error: OMIT, assistant_id: OMIT, phone_number_id: OMIT, customer_id: OMIT, squad_id: OMIT, call_id: OMIT, additional_properties: nil) @time = time @org_id = org_id @type = type + @webhook_type = webhook_type if webhook_type != OMIT @resource = resource if resource != OMIT @request_duration_seconds = request_duration_seconds @request_started_at = request_started_at @@ -118,6 +122,7 @@ def initialize(time:, org_id:, type:, request_duration_seconds:, request_started "time": time, "orgId": org_id, "type": type, + "webhookType": webhook_type, "resource": resource, "requestDurationSeconds": request_duration_seconds, "requestStartedAt": request_started_at, @@ -153,6 +158,7 @@ def self.from_json(json_object:) time = parsed_json["time"] org_id = parsed_json["orgId"] type = parsed_json["type"] + webhook_type = parsed_json["webhookType"] resource = parsed_json["resource"] request_duration_seconds = parsed_json["requestDurationSeconds"] request_started_at = parsed_json["requestStartedAt"] @@ -182,6 +188,7 @@ def self.from_json(json_object:) time: time, org_id: org_id, type: type, + webhook_type: webhook_type, resource: resource, request_duration_seconds: request_duration_seconds, request_started_at: request_started_at, @@ -220,9 +227,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.time.is_a?(Float) != false || raise("Passed value for field obj.time is not the expected type, validation failed.") + obj.time.is_a?(String) != false || raise("Passed value for field obj.time is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.type.is_a?(Vapi::LogType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") + obj.webhook_type&.is_a?(String) != false || raise("Passed value for field obj.webhook_type is not the expected type, validation failed.") obj.resource&.is_a?(Vapi::LogResource) != false || raise("Passed value for field obj.resource is not the expected type, validation failed.") obj.request_duration_seconds.is_a?(Float) != false || raise("Passed value for field obj.request_duration_seconds is not the expected type, validation failed.") obj.request_started_at.is_a?(String) != false || raise("Passed value for field obj.request_started_at is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/log_resource.rb b/lib/vapi_server_sdk/types/log_resource.rb index e226e1f..d9fc543 100644 --- a/lib/vapi_server_sdk/types/log_resource.rb +++ b/lib/vapi_server_sdk/types/log_resource.rb @@ -3,9 +3,17 @@ module Vapi # This is the specific resource, relevant only to API logs. class LogResource + ORG = "org" ASSISTANT = "assistant" + ANALYTICS = "analytics" + CREDENTIAL = "credential" PHONE_NUMBER = "phone-number" + BLOCK = "block" + VOICE_LIBRARY = "voice-library" + PROVIDER = "provider" TOOL = "tool" + TOKEN = "token" + TEMPLATE = "template" SQUAD = "squad" CALL = "call" FILE = "file" diff --git a/lib/vapi_server_sdk/types/make_credential.rb b/lib/vapi_server_sdk/types/make_credential.rb index 79fdd42..0eb677d 100644 --- a/lib/vapi_server_sdk/types/make_credential.rb +++ b/lib/vapi_server_sdk/types/make_credential.rb @@ -22,6 +22,8 @@ class MakeCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -38,9 +40,10 @@ class MakeCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::MakeCredential] - def initialize(provider:, team_id:, region:, api_key:, id:, org_id:, created_at:, updated_at:, + def initialize(provider:, team_id:, region:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @team_id = team_id @@ -50,6 +53,7 @@ def initialize(provider:, team_id:, region:, api_key:, id:, org_id:, created_at: @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -59,8 +63,11 @@ def initialize(provider:, team_id:, region:, api_key:, id:, org_id:, created_at: "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of MakeCredential @@ -78,6 +85,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, team_id: team_id, @@ -87,6 +95,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -113,6 +122,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb b/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb index 0bfb1e3..74d1c5b 100644 --- a/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +++ b/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb @@ -22,6 +22,8 @@ class MakeToolWithToolCall # `tool.destinations`. For others like the function tool, these can be custom # configured. attr_reader :messages + # @return [String] The type of tool. "make" for Make tool. + attr_reader :type # @return [Vapi::ToolCall] attr_reader :tool_call # @return [Vapi::MakeToolMetadata] @@ -61,6 +63,7 @@ class MakeToolWithToolCall # For some tools, this is auto-filled based on special fields like # `tool.destinations`. For others like the function tool, these can be custom # configured. + # @param type [String] The type of tool. "make" for Make tool. # @param tool_call [Vapi::ToolCall] # @param metadata [Vapi::MakeToolMetadata] # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. @@ -80,10 +83,11 @@ class MakeToolWithToolCall # phoneNumber.serverUrl, then org.serverUrl. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::MakeToolWithToolCall] - def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, + def initialize(type:, tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) @async = async if async != OMIT @messages = messages if messages != OMIT + @type = type @tool_call = tool_call @metadata = metadata @function = function if function != OMIT @@ -92,6 +96,7 @@ def initialize(tool_call:, metadata:, async: OMIT, messages: OMIT, function: OMI @_field_set = { "async": async, "messages": messages, + "type": type, "toolCall": tool_call, "metadata": metadata, "function": function, @@ -113,6 +118,7 @@ def self.from_json(json_object:) item = item.to_json Vapi::MakeToolWithToolCallMessagesItem.from_json(json_object: item) end + type = parsed_json["type"] if parsed_json["toolCall"].nil? tool_call = nil else @@ -140,6 +146,7 @@ def self.from_json(json_object:) new( async: async, messages: messages, + type: type, tool_call: tool_call, metadata: metadata, function: function, @@ -164,6 +171,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") Vapi::ToolCall.validate_raw(obj: obj.tool_call) Vapi::MakeToolMetadata.validate_raw(obj: obj.metadata) obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) diff --git a/lib/vapi_server_sdk/types/neets_voice.rb b/lib/vapi_server_sdk/types/neets_voice.rb index 6f2ee5c..e5acc42 100644 --- a/lib/vapi_server_sdk/types/neets_voice.rb +++ b/lib/vapi_server_sdk/types/neets_voice.rb @@ -2,20 +2,20 @@ require_relative "neets_voice_id" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class NeetsVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::NeetsVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -24,24 +24,19 @@ class NeetsVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::NeetsVoiceId] This is the provider-specific ID that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::NeetsVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties - @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, - "voiceId": voice_id, - "chunkPlan": chunk_plan - }.reject do |_k, v| + @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan, "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end end @@ -53,7 +48,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, chunk_plan: OMIT, addi def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -66,10 +60,16 @@ def self.from_json(json_object:) chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -88,9 +88,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::NeetsVoiceId.validate_raw(obj: obj.voice_id) obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb b/lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb new file mode 100644 index 0000000..22cb168 --- /dev/null +++ b/lib/vapi_server_sdk/types/o_auth_2_authentication_plan.rb @@ -0,0 +1,79 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class OAuth2AuthenticationPlan + # @return [String] + attr_reader :type + # @return [String] This is the OAuth2 URL. + attr_reader :url + # @return [String] This is the OAuth2 client ID. + attr_reader :client_id + # @return [String] This is the OAuth2 client secret. + attr_reader :client_secret + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param type [String] + # @param url [String] This is the OAuth2 URL. + # @param client_id [String] This is the OAuth2 client ID. + # @param client_secret [String] This is the OAuth2 client secret. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::OAuth2AuthenticationPlan] + def initialize(type:, url:, client_id:, client_secret:, additional_properties: nil) + @type = type + @url = url + @client_id = client_id + @client_secret = client_secret + @additional_properties = additional_properties + @_field_set = { "type": type, "url": url, "clientId": client_id, "clientSecret": client_secret } + end + + # Deserialize a JSON object to an instance of OAuth2AuthenticationPlan + # + # @param json_object [String] + # @return [Vapi::OAuth2AuthenticationPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + type = parsed_json["type"] + url = parsed_json["url"] + client_id = parsed_json["clientId"] + client_secret = parsed_json["clientSecret"] + new( + type: type, + url: url, + client_id: client_id, + client_secret: client_secret, + additional_properties: struct + ) + end + + # Serialize an instance of OAuth2AuthenticationPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") + obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") + obj.client_id.is_a?(String) != false || raise("Passed value for field obj.client_id is not the expected type, validation failed.") + obj.client_secret.is_a?(String) != false || raise("Passed value for field obj.client_secret is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/oauth_2_authentication_session.rb b/lib/vapi_server_sdk/types/oauth_2_authentication_session.rb new file mode 100644 index 0000000..de7157f --- /dev/null +++ b/lib/vapi_server_sdk/types/oauth_2_authentication_session.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class Oauth2AuthenticationSession + # @return [String] This is the OAuth2 access token. + attr_reader :access_token + # @return [DateTime] This is the OAuth2 access token expiration. + attr_reader :expires_at + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param access_token [String] This is the OAuth2 access token. + # @param expires_at [DateTime] This is the OAuth2 access token expiration. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::Oauth2AuthenticationSession] + def initialize(access_token: OMIT, expires_at: OMIT, additional_properties: nil) + @access_token = access_token if access_token != OMIT + @expires_at = expires_at if expires_at != OMIT + @additional_properties = additional_properties + @_field_set = { "accessToken": access_token, "expiresAt": expires_at }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of Oauth2AuthenticationSession + # + # @param json_object [String] + # @return [Vapi::Oauth2AuthenticationSession] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + access_token = parsed_json["accessToken"] + expires_at = (DateTime.parse(parsed_json["expiresAt"]) unless parsed_json["expiresAt"].nil?) + new( + access_token: access_token, + expires_at: expires_at, + additional_properties: struct + ) + end + + # Serialize an instance of Oauth2AuthenticationSession to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.access_token&.is_a?(String) != false || raise("Passed value for field obj.access_token is not the expected type, validation failed.") + obj.expires_at&.is_a?(DateTime) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/open_ai_credential.rb b/lib/vapi_server_sdk/types/open_ai_credential.rb index 0b661b7..7076f85 100644 --- a/lib/vapi_server_sdk/types/open_ai_credential.rb +++ b/lib/vapi_server_sdk/types/open_ai_credential.rb @@ -18,6 +18,8 @@ class OpenAiCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class OpenAiCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenAiCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of OpenAiCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/open_ai_function.rb b/lib/vapi_server_sdk/types/open_ai_function.rb index e182ec2..9cad77b 100644 --- a/lib/vapi_server_sdk/types/open_ai_function.rb +++ b/lib/vapi_server_sdk/types/open_ai_function.rb @@ -6,11 +6,20 @@ module Vapi class OpenAiFunction + # @return [Boolean] This is a boolean that controls whether to enable strict schema adherence when + # generating the function call. If set to true, the model will follow the exact + # schema defined in the parameters field. Only a subset of JSON Schema is + # supported when strict is true. Learn more about Structured Outputs in the + # [OpenAI + # guide](https://openai.com/index/introducing-structured-outputs-in-the-api/). + # @default false + attr_reader :strict # @return [String] This is the the name of the function to be called. # Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length # of 64. attr_reader :name - # @return [String] + # @return [String] This is the description of what the function does, used by the AI to choose when + # and how to call the function. attr_reader :description # @return [Vapi::OpenAiFunctionParameters] These are the parameters the functions accepts, described as a JSON Schema # object. @@ -28,10 +37,18 @@ class OpenAiFunction OMIT = Object.new + # @param strict [Boolean] This is a boolean that controls whether to enable strict schema adherence when + # generating the function call. If set to true, the model will follow the exact + # schema defined in the parameters field. Only a subset of JSON Schema is + # supported when strict is true. Learn more about Structured Outputs in the + # [OpenAI + # guide](https://openai.com/index/introducing-structured-outputs-in-the-api/). + # @default false # @param name [String] This is the the name of the function to be called. # Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length # of 64. - # @param description [String] + # @param description [String] This is the description of what the function does, used by the AI to choose when + # and how to call the function. # @param parameters [Vapi::OpenAiFunctionParameters] These are the parameters the functions accepts, described as a JSON Schema # object. # See the [OpenAI guide](https://platform.openai.com/docs/guides/function-calling) @@ -41,12 +58,18 @@ class OpenAiFunction # Omitting parameters defines a function with an empty parameter list. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenAiFunction] - def initialize(name:, description: OMIT, parameters: OMIT, additional_properties: nil) + def initialize(name:, strict: OMIT, description: OMIT, parameters: OMIT, additional_properties: nil) + @strict = strict if strict != OMIT @name = name @description = description if description != OMIT @parameters = parameters if parameters != OMIT @additional_properties = additional_properties - @_field_set = { "name": name, "description": description, "parameters": parameters }.reject do |_k, v| + @_field_set = { + "strict": strict, + "name": name, + "description": description, + "parameters": parameters + }.reject do |_k, v| v == OMIT end end @@ -58,6 +81,7 @@ def initialize(name:, description: OMIT, parameters: OMIT, additional_properties def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + strict = parsed_json["strict"] name = parsed_json["name"] description = parsed_json["description"] if parsed_json["parameters"].nil? @@ -67,6 +91,7 @@ def self.from_json(json_object:) parameters = Vapi::OpenAiFunctionParameters.from_json(json_object: parameters) end new( + strict: strict, name: name, description: description, parameters: parameters, @@ -88,6 +113,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.strict&.is_a?(Boolean) != false || raise("Passed value for field obj.strict is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.parameters.nil? || Vapi::OpenAiFunctionParameters.validate_raw(obj: obj.parameters) diff --git a/lib/vapi_server_sdk/types/open_ai_model.rb b/lib/vapi_server_sdk/types/open_ai_model.rb index 71b3bbb..dbb03c1 100644 --- a/lib/vapi_server_sdk/types/open_ai_model.rb +++ b/lib/vapi_server_sdk/types/open_ai_model.rb @@ -2,9 +2,9 @@ require_relative "open_ai_message" require_relative "open_ai_model_tools_item" +require_relative "create_custom_knowledge_base_dto" require_relative "open_ai_model_model" require_relative "open_ai_model_fallback_models_item" -require_relative "knowledge_base" require "ostruct" require "json" @@ -20,6 +20,10 @@ class OpenAiModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [Vapi::OpenAiModelModel] This is the OpenAI model that will be used. attr_reader :model # @return [Array] These are the fallback models that will be used if the primary model fails. This @@ -31,8 +35,6 @@ class OpenAiModel # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -63,6 +65,8 @@ class OpenAiModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [Vapi::OpenAiModelModel] This is the OpenAI model that will be used. # @param fallback_models [Array] These are the fallback models that will be used if the primary model fails. This # shouldn't be specified unless you have a specific reason to do so. Vapi will @@ -70,7 +74,6 @@ class OpenAiModel # @param semantic_caching_enabled [Boolean] # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -85,16 +88,17 @@ class OpenAiModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenAiModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, fallback_models: OMIT, - semantic_caching_enabled: OMIT, temperature: OMIT, knowledge_base: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + fallback_models: OMIT, semantic_caching_enabled: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @fallback_models = fallback_models if fallback_models != OMIT @semantic_caching_enabled = semantic_caching_enabled if semantic_caching_enabled != OMIT @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -103,11 +107,12 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, fallback_mod "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "fallbackModels": fallback_models, "semanticCachingEnabled": semantic_caching_enabled, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -132,16 +137,17 @@ def self.from_json(json_object:) Vapi::OpenAiModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - fallback_models = parsed_json["fallbackModels"] - semantic_caching_enabled = parsed_json["semanticCachingEnabled"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + fallback_models = parsed_json["fallbackModels"] + semantic_caching_enabled = parsed_json["semanticCachingEnabled"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -149,11 +155,12 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, fallback_models: fallback_models, semantic_caching_enabled: semantic_caching_enabled, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -178,11 +185,12 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(Vapi::OpenAiModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.fallback_models&.is_a?(Array) != false || raise("Passed value for field obj.fallback_models is not the expected type, validation failed.") obj.semantic_caching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.semantic_caching_enabled is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb b/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb index 598f988..d67741f 100644 --- a/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +++ b/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb @@ -2,11 +2,13 @@ module Vapi class OpenAiModelFallbackModelsItem + GPT_4_O_REALTIME_PREVIEW_20241001 = "gpt-4o-realtime-preview-2024-10-01" GPT_4_O_MINI = "gpt-4o-mini" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O = "gpt-4o" GPT_4_O_20240513 = "gpt-4o-2024-05-13" GPT_4_O_20240806 = "gpt-4o-2024-08-06" + GPT_4_O_20241120 = "gpt-4o-2024-11-20" GPT_4_TURBO = "gpt-4-turbo" GPT_4_TURBO_20240409 = "gpt-4-turbo-2024-04-09" GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview" diff --git a/lib/vapi_server_sdk/types/open_ai_model_model.rb b/lib/vapi_server_sdk/types/open_ai_model_model.rb index 38cbed7..be2bce0 100644 --- a/lib/vapi_server_sdk/types/open_ai_model_model.rb +++ b/lib/vapi_server_sdk/types/open_ai_model_model.rb @@ -3,11 +3,13 @@ module Vapi # This is the OpenAI model that will be used. class OpenAiModelModel + GPT_4_O_REALTIME_PREVIEW_20241001 = "gpt-4o-realtime-preview-2024-10-01" GPT_4_O_MINI = "gpt-4o-mini" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O = "gpt-4o" GPT_4_O_20240513 = "gpt-4o-2024-05-13" GPT_4_O_20240806 = "gpt-4o-2024-08-06" + GPT_4_O_20241120 = "gpt-4o-2024-11-20" GPT_4_TURBO = "gpt-4-turbo" GPT_4_TURBO_20240409 = "gpt-4-turbo-2024-04-09" GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview" diff --git a/lib/vapi_server_sdk/types/open_ai_voice.rb b/lib/vapi_server_sdk/types/open_ai_voice.rb index 360f27b..16c4108 100644 --- a/lib/vapi_server_sdk/types/open_ai_voice.rb +++ b/lib/vapi_server_sdk/types/open_ai_voice.rb @@ -2,22 +2,24 @@ require_relative "open_ai_voice_id" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class OpenAiVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::OpenAiVoiceId] This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. attr_reader :voice_id # @return [Float] This is the speed multiplier that will be used. attr_reader :speed # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -26,26 +28,27 @@ class OpenAiVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::OpenAiVoiceId] This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenAiVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @speed = speed if speed != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, "speed": speed, - "chunkPlan": chunk_plan + "chunkPlan": chunk_plan, + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -58,7 +61,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, chunk_pla def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] voice_id = parsed_json["voiceId"] speed = parsed_json["speed"] if parsed_json["chunkPlan"].nil? @@ -67,11 +69,17 @@ def self.from_json(json_object:) chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, speed: speed, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -90,10 +98,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") obj.voice_id.is_a?(Vapi::OpenAiVoiceId) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/open_ai_voice_id.rb b/lib/vapi_server_sdk/types/open_ai_voice_id.rb index ecf583e..3dd09b2 100644 --- a/lib/vapi_server_sdk/types/open_ai_voice_id.rb +++ b/lib/vapi_server_sdk/types/open_ai_voice_id.rb @@ -2,6 +2,8 @@ module Vapi # This is the provider-specific ID that will be used. + # Please note that ash, ballad, coral, sage, and verse may only be used with the + # `gpt-4o-realtime-preview-2024-10-01` model. class OpenAiVoiceId ALLOY = "alloy" ECHO = "echo" @@ -9,5 +11,10 @@ class OpenAiVoiceId ONYX = "onyx" NOVA = "nova" SHIMMER = "shimmer" + ASH = "ash" + BALLAD = "ballad" + CORAL = "coral" + SAGE = "sage" + VERSE = "verse" end end diff --git a/lib/vapi_server_sdk/types/open_router_credential.rb b/lib/vapi_server_sdk/types/open_router_credential.rb index f5c6a39..07990b5 100644 --- a/lib/vapi_server_sdk/types/open_router_credential.rb +++ b/lib/vapi_server_sdk/types/open_router_credential.rb @@ -18,6 +18,8 @@ class OpenRouterCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class OpenRouterCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenRouterCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of OpenRouterCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/open_router_model.rb b/lib/vapi_server_sdk/types/open_router_model.rb index 9146650..dc48137 100644 --- a/lib/vapi_server_sdk/types/open_router_model.rb +++ b/lib/vapi_server_sdk/types/open_router_model.rb @@ -2,7 +2,7 @@ require_relative "open_ai_message" require_relative "open_router_model_tools_item" -require_relative "knowledge_base" +require_relative "create_custom_knowledge_base_dto" require "ostruct" require "json" @@ -18,13 +18,15 @@ class OpenRouterModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -55,10 +57,11 @@ class OpenRouterModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -73,14 +76,15 @@ class OpenRouterModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OpenRouterModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -89,9 +93,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -116,14 +121,15 @@ def self.from_json(json_object:) Vapi::OpenRouterModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -131,9 +137,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -158,9 +165,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/org.rb b/lib/vapi_server_sdk/types/org.rb index cc9ef73..a4463c8 100644 --- a/lib/vapi_server_sdk/types/org.rb +++ b/lib/vapi_server_sdk/types/org.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true +require_relative "subscription" require "date" require_relative "org_plan" +require_relative "org_channel" require "ostruct" require "json" @@ -15,6 +17,10 @@ class Org # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. attr_reader :hipaa_enabled + # @return [Vapi::Subscription] + attr_reader :subscription + # @return [String] This is the ID of the subscription the org belongs to. + attr_reader :subscription_id # @return [String] This is the unique identifier for the org. attr_reader :id # @return [DateTime] This is the ISO 8601 date-time string of when the org was created. @@ -35,6 +41,9 @@ class Org attr_reader :plan # @return [String] This is the name of the org. This is just for your own reference. attr_reader :name + # @return [Vapi::OrgChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + attr_reader :channel # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit @@ -65,6 +74,8 @@ class Org # available for LLM and Voice respectively. # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. + # @param subscription [Vapi::Subscription] + # @param subscription_id [String] This is the ID of the subscription the org belongs to. # @param id [String] This is the unique identifier for the org. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the org was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the org was last updated. @@ -75,6 +86,8 @@ class Org # @param stripe_subscription_status [String] This is the subscription's status. # @param plan [Vapi::OrgPlan] This is the plan for the org. # @param name [String] This is the name of the org. This is just for your own reference. + # @param channel [Vapi::OrgChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This @@ -88,9 +101,11 @@ class Org # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Org] - def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, stripe_customer_id: OMIT, - stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) + def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: OMIT, subscription_id: OMIT, + stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT + @subscription = subscription if subscription != OMIT + @subscription_id = subscription_id if subscription_id != OMIT @id = id @created_at = created_at @updated_at = updated_at @@ -103,6 +118,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, stripe_custom @stripe_subscription_status = stripe_subscription_status if stripe_subscription_status != OMIT @plan = plan if plan != OMIT @name = name if name != OMIT + @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT @server_url = server_url if server_url != OMIT @server_url_secret = server_url_secret if server_url_secret != OMIT @@ -110,6 +126,8 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, stripe_custom @additional_properties = additional_properties @_field_set = { "hipaaEnabled": hipaa_enabled, + "subscription": subscription, + "subscriptionId": subscription_id, "id": id, "createdAt": created_at, "updatedAt": updated_at, @@ -120,6 +138,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, stripe_custom "stripeSubscriptionStatus": stripe_subscription_status, "plan": plan, "name": name, + "channel": channel, "billingLimit": billing_limit, "serverUrl": server_url, "serverUrlSecret": server_url_secret, @@ -137,6 +156,13 @@ def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) hipaa_enabled = parsed_json["hipaaEnabled"] + if parsed_json["subscription"].nil? + subscription = nil + else + subscription = parsed_json["subscription"].to_json + subscription = Vapi::Subscription.from_json(json_object: subscription) + end + subscription_id = parsed_json["subscriptionId"] id = parsed_json["id"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) @@ -154,12 +180,15 @@ def self.from_json(json_object:) plan = Vapi::OrgPlan.from_json(json_object: plan) end name = parsed_json["name"] + channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] server_url = parsed_json["serverUrl"] server_url_secret = parsed_json["serverUrlSecret"] concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, + subscription: subscription, + subscription_id: subscription_id, id: id, created_at: created_at, updated_at: updated_at, @@ -170,6 +199,7 @@ def self.from_json(json_object:) stripe_subscription_status: stripe_subscription_status, plan: plan, name: name, + channel: channel, billing_limit: billing_limit, server_url: server_url, server_url_secret: server_url_secret, @@ -193,6 +223,8 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") + obj.subscription.nil? || Vapi::Subscription.validate_raw(obj: obj.subscription) + obj.subscription_id&.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") @@ -203,6 +235,7 @@ def self.validate_raw(obj:) obj.stripe_subscription_status&.is_a?(String) != false || raise("Passed value for field obj.stripe_subscription_status is not the expected type, validation failed.") obj.plan.nil? || Vapi::OrgPlan.validate_raw(obj: obj.plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.channel&.is_a?(Vapi::OrgChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/org_channel.rb b/lib/vapi_server_sdk/types/org_channel.rb new file mode 100644 index 0000000..e118da6 --- /dev/null +++ b/lib/vapi_server_sdk/types/org_channel.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + class OrgChannel + DEFAULT = "default" + WEEKLY = "weekly" + end +end diff --git a/lib/vapi_server_sdk/types/org_with_org_user.rb b/lib/vapi_server_sdk/types/org_with_org_user.rb new file mode 100644 index 0000000..0d87bee --- /dev/null +++ b/lib/vapi_server_sdk/types/org_with_org_user.rb @@ -0,0 +1,262 @@ +# frozen_string_literal: true + +require_relative "subscription" +require "date" +require_relative "org_plan" +require_relative "org_with_org_user_channel" +require_relative "org_with_org_user_role" +require "ostruct" +require "json" + +module Vapi + class OrgWithOrgUser + # @return [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At + # the end of the call, you will still receive an end-of-call-report message to + # store on your server. Defaults to false. + # When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be + # available for LLM and Voice respectively. + # This is due to the compliance requirements of HIPAA. Other providers may not + # meet these requirements. + attr_reader :hipaa_enabled + # @return [Vapi::Subscription] + attr_reader :subscription + # @return [String] This is the ID of the subscription the org belongs to. + attr_reader :subscription_id + # @return [String] This is the unique identifier for the org. + attr_reader :id + # @return [DateTime] This is the ISO 8601 date-time string of when the org was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the org was last updated. + attr_reader :updated_at + # @return [String] This is the Stripe customer for the org. + attr_reader :stripe_customer_id + # @return [String] This is the subscription for the org. + attr_reader :stripe_subscription_id + # @return [String] This is the subscription's subscription item. + attr_reader :stripe_subscription_item_id + # @return [DateTime] This is the subscription's current period start. + attr_reader :stripe_subscription_current_period_start + # @return [String] This is the subscription's status. + attr_reader :stripe_subscription_status + # @return [Vapi::OrgPlan] This is the plan for the org. + attr_reader :plan + # @return [String] This is the name of the org. This is just for your own reference. + attr_reader :name + # @return [Vapi::OrgWithOrgUserChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + attr_reader :channel + # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please + # contact us at support@vapi.ai. + attr_reader :billing_limit + # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This + # is used for retrieving context, function calling, and end-of-call reports. + # All requests will be sent with the call object among other things relevant to + # that message. You can find more details in the Server URL documentation. + attr_reader :server_url + # @return [String] This is the secret you can set that Vapi will send with every request to your + # server. Will be sent as a header called x-vapi-secret. + attr_reader :server_url_secret + # @return [Float] This is the concurrency limit for the org. This is the maximum number of calls + # that can be active at any given time. To go beyond 10, please contact us at + # support@vapi.ai. + attr_reader :concurrency_limit + # @return [String] + attr_reader :invited_by_user_id + # @return [Vapi::OrgWithOrgUserRole] + attr_reader :role + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param hipaa_enabled [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At + # the end of the call, you will still receive an end-of-call-report message to + # store on your server. Defaults to false. + # When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be + # available for LLM and Voice respectively. + # This is due to the compliance requirements of HIPAA. Other providers may not + # meet these requirements. + # @param subscription [Vapi::Subscription] + # @param subscription_id [String] This is the ID of the subscription the org belongs to. + # @param id [String] This is the unique identifier for the org. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the org was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the org was last updated. + # @param stripe_customer_id [String] This is the Stripe customer for the org. + # @param stripe_subscription_id [String] This is the subscription for the org. + # @param stripe_subscription_item_id [String] This is the subscription's subscription item. + # @param stripe_subscription_current_period_start [DateTime] This is the subscription's current period start. + # @param stripe_subscription_status [String] This is the subscription's status. + # @param plan [Vapi::OrgPlan] This is the plan for the org. + # @param name [String] This is the name of the org. This is just for your own reference. + # @param channel [Vapi::OrgWithOrgUserChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please + # contact us at support@vapi.ai. + # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This + # is used for retrieving context, function calling, and end-of-call reports. + # All requests will be sent with the call object among other things relevant to + # that message. You can find more details in the Server URL documentation. + # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your + # server. Will be sent as a header called x-vapi-secret. + # @param concurrency_limit [Float] This is the concurrency limit for the org. This is the maximum number of calls + # that can be active at any given time. To go beyond 10, please contact us at + # support@vapi.ai. + # @param invited_by_user_id [String] + # @param role [Vapi::OrgWithOrgUserRole] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::OrgWithOrgUser] + def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: OMIT, subscription_id: OMIT, + stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, invited_by_user_id: OMIT, role: OMIT, additional_properties: nil) + @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT + @subscription = subscription if subscription != OMIT + @subscription_id = subscription_id if subscription_id != OMIT + @id = id + @created_at = created_at + @updated_at = updated_at + @stripe_customer_id = stripe_customer_id if stripe_customer_id != OMIT + @stripe_subscription_id = stripe_subscription_id if stripe_subscription_id != OMIT + @stripe_subscription_item_id = stripe_subscription_item_id if stripe_subscription_item_id != OMIT + if stripe_subscription_current_period_start != OMIT + @stripe_subscription_current_period_start = stripe_subscription_current_period_start + end + @stripe_subscription_status = stripe_subscription_status if stripe_subscription_status != OMIT + @plan = plan if plan != OMIT + @name = name if name != OMIT + @channel = channel if channel != OMIT + @billing_limit = billing_limit if billing_limit != OMIT + @server_url = server_url if server_url != OMIT + @server_url_secret = server_url_secret if server_url_secret != OMIT + @concurrency_limit = concurrency_limit if concurrency_limit != OMIT + @invited_by_user_id = invited_by_user_id if invited_by_user_id != OMIT + @role = role if role != OMIT + @additional_properties = additional_properties + @_field_set = { + "hipaaEnabled": hipaa_enabled, + "subscription": subscription, + "subscriptionId": subscription_id, + "id": id, + "createdAt": created_at, + "updatedAt": updated_at, + "stripeCustomerId": stripe_customer_id, + "stripeSubscriptionId": stripe_subscription_id, + "stripeSubscriptionItemId": stripe_subscription_item_id, + "stripeSubscriptionCurrentPeriodStart": stripe_subscription_current_period_start, + "stripeSubscriptionStatus": stripe_subscription_status, + "plan": plan, + "name": name, + "channel": channel, + "billingLimit": billing_limit, + "serverUrl": server_url, + "serverUrlSecret": server_url_secret, + "concurrencyLimit": concurrency_limit, + "invitedByUserId": invited_by_user_id, + "role": role + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of OrgWithOrgUser + # + # @param json_object [String] + # @return [Vapi::OrgWithOrgUser] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + hipaa_enabled = parsed_json["hipaaEnabled"] + if parsed_json["subscription"].nil? + subscription = nil + else + subscription = parsed_json["subscription"].to_json + subscription = Vapi::Subscription.from_json(json_object: subscription) + end + subscription_id = parsed_json["subscriptionId"] + id = parsed_json["id"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + stripe_customer_id = parsed_json["stripeCustomerId"] + stripe_subscription_id = parsed_json["stripeSubscriptionId"] + stripe_subscription_item_id = parsed_json["stripeSubscriptionItemId"] + stripe_subscription_current_period_start = unless parsed_json["stripeSubscriptionCurrentPeriodStart"].nil? + DateTime.parse(parsed_json["stripeSubscriptionCurrentPeriodStart"]) + end + stripe_subscription_status = parsed_json["stripeSubscriptionStatus"] + if parsed_json["plan"].nil? + plan = nil + else + plan = parsed_json["plan"].to_json + plan = Vapi::OrgPlan.from_json(json_object: plan) + end + name = parsed_json["name"] + channel = parsed_json["channel"] + billing_limit = parsed_json["billingLimit"] + server_url = parsed_json["serverUrl"] + server_url_secret = parsed_json["serverUrlSecret"] + concurrency_limit = parsed_json["concurrencyLimit"] + invited_by_user_id = parsed_json["invitedByUserId"] + role = parsed_json["role"] + new( + hipaa_enabled: hipaa_enabled, + subscription: subscription, + subscription_id: subscription_id, + id: id, + created_at: created_at, + updated_at: updated_at, + stripe_customer_id: stripe_customer_id, + stripe_subscription_id: stripe_subscription_id, + stripe_subscription_item_id: stripe_subscription_item_id, + stripe_subscription_current_period_start: stripe_subscription_current_period_start, + stripe_subscription_status: stripe_subscription_status, + plan: plan, + name: name, + channel: channel, + billing_limit: billing_limit, + server_url: server_url, + server_url_secret: server_url_secret, + concurrency_limit: concurrency_limit, + invited_by_user_id: invited_by_user_id, + role: role, + additional_properties: struct + ) + end + + # Serialize an instance of OrgWithOrgUser to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") + obj.subscription.nil? || Vapi::Subscription.validate_raw(obj: obj.subscription) + obj.subscription_id&.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.stripe_customer_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_customer_id is not the expected type, validation failed.") + obj.stripe_subscription_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_subscription_id is not the expected type, validation failed.") + obj.stripe_subscription_item_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_subscription_item_id is not the expected type, validation failed.") + obj.stripe_subscription_current_period_start&.is_a?(DateTime) != false || raise("Passed value for field obj.stripe_subscription_current_period_start is not the expected type, validation failed.") + obj.stripe_subscription_status&.is_a?(String) != false || raise("Passed value for field obj.stripe_subscription_status is not the expected type, validation failed.") + obj.plan.nil? || Vapi::OrgPlan.validate_raw(obj: obj.plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.channel&.is_a?(Vapi::OrgWithOrgUserChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") + obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") + obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") + obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.concurrency_limit&.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") + obj.invited_by_user_id&.is_a?(String) != false || raise("Passed value for field obj.invited_by_user_id is not the expected type, validation failed.") + obj.role&.is_a?(Vapi::OrgWithOrgUserRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/org_with_org_user_channel.rb b/lib/vapi_server_sdk/types/org_with_org_user_channel.rb new file mode 100644 index 0000000..f33bd2d --- /dev/null +++ b/lib/vapi_server_sdk/types/org_with_org_user_channel.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + class OrgWithOrgUserChannel + DEFAULT = "default" + WEEKLY = "weekly" + end +end diff --git a/lib/vapi_server_sdk/types/org_with_org_user_role.rb b/lib/vapi_server_sdk/types/org_with_org_user_role.rb new file mode 100644 index 0000000..d40bdd2 --- /dev/null +++ b/lib/vapi_server_sdk/types/org_with_org_user_role.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + class OrgWithOrgUserRole + ADMIN = "admin" + EDITOR = "editor" + VIEWER = "viewer" + end +end diff --git a/lib/vapi_server_sdk/types/payment.rb b/lib/vapi_server_sdk/types/payment.rb new file mode 100644 index 0000000..305c40c --- /dev/null +++ b/lib/vapi_server_sdk/types/payment.rb @@ -0,0 +1,167 @@ +# frozen_string_literal: true + +require_relative "payment_status" +require "date" +require "ostruct" +require "json" + +module Vapi + class Payment + # @return [String] This is the id of the payment + attr_reader :id + # @return [String] This is the id of the org + attr_reader :org_id + # @return [String] This is the total cost of the payment, which is the sum of all the costs in the + # costs object. + # Note: this is a string to avoid floating point precision issues. + attr_reader :cost + # @return [Array Object}>] This is the itemized breakdown of payment amounts + attr_reader :costs + # @return [Vapi::PaymentStatus] This is the status of the payment + attr_reader :status + # @return [DateTime] This is the timestamp when the payment was created + attr_reader :created_at + # @return [DateTime] This is the timestamp when the payment was last updated + attr_reader :updated_at + # @return [Boolean] This indicates if this payment was automatically generated by the auto-reload + # feature + attr_reader :is_auto_reload + # @return [String] This is the id of the subscription the payment belongs to + attr_reader :subscription_id + # @return [String] This is the id of the call + attr_reader :call_id + # @return [String] This is the id of the purchased phone number + attr_reader :phone_number_id + # @return [String] This is the id of the associated stripe payment intent + attr_reader :stripe_payment_intent_id + # @return [String] This is the id of the associated stripe invoice + attr_reader :stripe_invoice_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param id [String] This is the id of the payment + # @param org_id [String] This is the id of the org + # @param cost [String] This is the total cost of the payment, which is the sum of all the costs in the + # costs object. + # Note: this is a string to avoid floating point precision issues. + # @param costs [Array Object}>] This is the itemized breakdown of payment amounts + # @param status [Vapi::PaymentStatus] This is the status of the payment + # @param created_at [DateTime] This is the timestamp when the payment was created + # @param updated_at [DateTime] This is the timestamp when the payment was last updated + # @param is_auto_reload [Boolean] This indicates if this payment was automatically generated by the auto-reload + # feature + # @param subscription_id [String] This is the id of the subscription the payment belongs to + # @param call_id [String] This is the id of the call + # @param phone_number_id [String] This is the id of the purchased phone number + # @param stripe_payment_intent_id [String] This is the id of the associated stripe payment intent + # @param stripe_invoice_id [String] This is the id of the associated stripe invoice + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::Payment] + def initialize(id:, cost:, costs:, status:, created_at:, updated_at:, is_auto_reload:, subscription_id:, + org_id: OMIT, call_id: OMIT, phone_number_id: OMIT, stripe_payment_intent_id: OMIT, stripe_invoice_id: OMIT, additional_properties: nil) + @id = id + @org_id = org_id if org_id != OMIT + @cost = cost + @costs = costs + @status = status + @created_at = created_at + @updated_at = updated_at + @is_auto_reload = is_auto_reload + @subscription_id = subscription_id + @call_id = call_id if call_id != OMIT + @phone_number_id = phone_number_id if phone_number_id != OMIT + @stripe_payment_intent_id = stripe_payment_intent_id if stripe_payment_intent_id != OMIT + @stripe_invoice_id = stripe_invoice_id if stripe_invoice_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "id": id, + "orgId": org_id, + "cost": cost, + "costs": costs, + "status": status, + "createdAt": created_at, + "updatedAt": updated_at, + "isAutoReload": is_auto_reload, + "subscriptionId": subscription_id, + "callId": call_id, + "phoneNumberId": phone_number_id, + "stripePaymentIntentId": stripe_payment_intent_id, + "stripeInvoiceId": stripe_invoice_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of Payment + # + # @param json_object [String] + # @return [Vapi::Payment] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + id = parsed_json["id"] + org_id = parsed_json["orgId"] + cost = parsed_json["cost"] + costs = parsed_json["costs"] + status = parsed_json["status"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + is_auto_reload = parsed_json["isAutoReload"] + subscription_id = parsed_json["subscriptionId"] + call_id = parsed_json["callId"] + phone_number_id = parsed_json["phoneNumberId"] + stripe_payment_intent_id = parsed_json["stripePaymentIntentId"] + stripe_invoice_id = parsed_json["stripeInvoiceId"] + new( + id: id, + org_id: org_id, + cost: cost, + costs: costs, + status: status, + created_at: created_at, + updated_at: updated_at, + is_auto_reload: is_auto_reload, + subscription_id: subscription_id, + call_id: call_id, + phone_number_id: phone_number_id, + stripe_payment_intent_id: stripe_payment_intent_id, + stripe_invoice_id: stripe_invoice_id, + additional_properties: struct + ) + end + + # Serialize an instance of Payment to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id&.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.cost.is_a?(String) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.") + obj.costs.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.") + obj.status.is_a?(Vapi::PaymentStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.is_auto_reload.is_a?(Boolean) != false || raise("Passed value for field obj.is_auto_reload is not the expected type, validation failed.") + obj.subscription_id.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") + obj.call_id&.is_a?(String) != false || raise("Passed value for field obj.call_id is not the expected type, validation failed.") + obj.phone_number_id&.is_a?(String) != false || raise("Passed value for field obj.phone_number_id is not the expected type, validation failed.") + obj.stripe_payment_intent_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_intent_id is not the expected type, validation failed.") + obj.stripe_invoice_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_invoice_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/payment_retry_dto.rb b/lib/vapi_server_sdk/types/payment_retry_dto.rb new file mode 100644 index 0000000..47d17b8 --- /dev/null +++ b/lib/vapi_server_sdk/types/payment_retry_dto.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class PaymentRetryDto + # @return [String] This is the payment ID to retry. + attr_reader :payment_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param payment_id [String] This is the payment ID to retry. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::PaymentRetryDto] + def initialize(payment_id:, additional_properties: nil) + @payment_id = payment_id + @additional_properties = additional_properties + @_field_set = { "paymentId": payment_id } + end + + # Deserialize a JSON object to an instance of PaymentRetryDto + # + # @param json_object [String] + # @return [Vapi::PaymentRetryDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + payment_id = parsed_json["paymentId"] + new(payment_id: payment_id, additional_properties: struct) + end + + # Serialize an instance of PaymentRetryDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.payment_id.is_a?(String) != false || raise("Passed value for field obj.payment_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/payment_status.rb b/lib/vapi_server_sdk/types/payment_status.rb new file mode 100644 index 0000000..48dc867 --- /dev/null +++ b/lib/vapi_server_sdk/types/payment_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Vapi + # This is the status of the payment + class PaymentStatus + PAST_DUE = "past-due" + PENDING = "pending" + FINALIZED = "finalized" + REFUNDED = "refunded" + end +end diff --git a/lib/vapi_server_sdk/types/payments_paginated_response.rb b/lib/vapi_server_sdk/types/payments_paginated_response.rb new file mode 100644 index 0000000..c5657cf --- /dev/null +++ b/lib/vapi_server_sdk/types/payments_paginated_response.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require_relative "payment" +require_relative "pagination_meta" +require "ostruct" +require "json" + +module Vapi + class PaymentsPaginatedResponse + # @return [Array] + attr_reader :results + # @return [Vapi::PaginationMeta] + attr_reader :metadata + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param results [Array] + # @param metadata [Vapi::PaginationMeta] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::PaymentsPaginatedResponse] + def initialize(results:, metadata:, additional_properties: nil) + @results = results + @metadata = metadata + @additional_properties = additional_properties + @_field_set = { "results": results, "metadata": metadata } + end + + # Deserialize a JSON object to an instance of PaymentsPaginatedResponse + # + # @param json_object [String] + # @return [Vapi::PaymentsPaginatedResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + results = parsed_json["results"]&.map do |item| + item = item.to_json + Vapi::Payment.from_json(json_object: item) + end + if parsed_json["metadata"].nil? + metadata = nil + else + metadata = parsed_json["metadata"].to_json + metadata = Vapi::PaginationMeta.from_json(json_object: metadata) + end + new( + results: results, + metadata: metadata, + additional_properties: struct + ) + end + + # Serialize an instance of PaymentsPaginatedResponse to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") + Vapi::PaginationMeta.validate_raw(obj: obj.metadata) + end + end +end diff --git a/lib/vapi_server_sdk/types/perplexity_ai_credential.rb b/lib/vapi_server_sdk/types/perplexity_ai_credential.rb index 6943506..efd2b3c 100644 --- a/lib/vapi_server_sdk/types/perplexity_ai_credential.rb +++ b/lib/vapi_server_sdk/types/perplexity_ai_credential.rb @@ -18,6 +18,8 @@ class PerplexityAiCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class PerplexityAiCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::PerplexityAiCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of PerplexityAiCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/perplexity_ai_model.rb b/lib/vapi_server_sdk/types/perplexity_ai_model.rb index 9cc780c..12a14ca 100644 --- a/lib/vapi_server_sdk/types/perplexity_ai_model.rb +++ b/lib/vapi_server_sdk/types/perplexity_ai_model.rb @@ -2,7 +2,7 @@ require_relative "open_ai_message" require_relative "perplexity_ai_model_tools_item" -require_relative "knowledge_base" +require_relative "create_custom_knowledge_base_dto" require "ostruct" require "json" @@ -18,13 +18,15 @@ class PerplexityAiModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -55,10 +57,11 @@ class PerplexityAiModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -73,14 +76,15 @@ class PerplexityAiModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::PerplexityAiModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -89,9 +93,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -116,14 +121,15 @@ def self.from_json(json_object:) Vapi::PerplexityAiModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -131,9 +137,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -158,9 +165,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/phone_number_paginated_response.rb b/lib/vapi_server_sdk/types/phone_number_paginated_response.rb new file mode 100644 index 0000000..08c3ad4 --- /dev/null +++ b/lib/vapi_server_sdk/types/phone_number_paginated_response.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require_relative "phone_number_paginated_response_results_item" +require_relative "pagination_meta" +require "ostruct" +require "json" + +module Vapi + class PhoneNumberPaginatedResponse + # @return [Array] A list of phone numbers, which can be of any provider type. + attr_reader :results + # @return [Vapi::PaginationMeta] Metadata about the pagination. + attr_reader :metadata + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param results [Array] A list of phone numbers, which can be of any provider type. + # @param metadata [Vapi::PaginationMeta] Metadata about the pagination. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::PhoneNumberPaginatedResponse] + def initialize(results:, metadata:, additional_properties: nil) + @results = results + @metadata = metadata + @additional_properties = additional_properties + @_field_set = { "results": results, "metadata": metadata } + end + + # Deserialize a JSON object to an instance of PhoneNumberPaginatedResponse + # + # @param json_object [String] + # @return [Vapi::PhoneNumberPaginatedResponse] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + results = parsed_json["results"]&.map do |item| + item = item.to_json + Vapi::PhoneNumberPaginatedResponseResultsItem.from_json(json_object: item) + end + if parsed_json["metadata"].nil? + metadata = nil + else + metadata = parsed_json["metadata"].to_json + metadata = Vapi::PaginationMeta.from_json(json_object: metadata) + end + new( + results: results, + metadata: metadata, + additional_properties: struct + ) + end + + # Serialize an instance of PhoneNumberPaginatedResponse to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") + Vapi::PaginationMeta.validate_raw(obj: obj.metadata) + end + end +end diff --git a/lib/vapi_server_sdk/types/phone_number_paginated_response_results_item.rb b/lib/vapi_server_sdk/types/phone_number_paginated_response_results_item.rb new file mode 100644 index 0000000..7d4023c --- /dev/null +++ b/lib/vapi_server_sdk/types/phone_number_paginated_response_results_item.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +require "json" +require_relative "byo_phone_number" +require_relative "twilio_phone_number" +require_relative "vonage_phone_number" +require_relative "vapi_phone_number" + +module Vapi + class PhoneNumberPaginatedResponseResultsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # PhoneNumberPaginatedResponseResultsItem + # + # @param json_object [String] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "byo-phone-number" + Vapi::ByoPhoneNumber.from_json(json_object: json_object) + when "twilio" + Vapi::TwilioPhoneNumber.from_json(json_object: json_object) + when "vonage" + Vapi::VonagePhoneNumber.from_json(json_object: json_object) + when "vapi" + Vapi::VapiPhoneNumber.from_json(json_object: json_object) + else + Vapi::ByoPhoneNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "byo-phone-number" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "vapi" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "byo-phone-number" + Vapi::ByoPhoneNumber.validate_raw(obj: obj) + when "twilio" + Vapi::TwilioPhoneNumber.validate_raw(obj: obj) + when "vonage" + Vapi::VonagePhoneNumber.validate_raw(obj: obj) + when "vapi" + Vapi::VapiPhoneNumber.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ByoPhoneNumber] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def self.byo_phone_number(member:) + new(member: member, discriminant: "byo-phone-number") + end + + # @param member [Vapi::TwilioPhoneNumber] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::VonagePhoneNumber] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::VapiPhoneNumber] + # @return [Vapi::PhoneNumberPaginatedResponseResultsItem] + def self.vapi(member:) + new(member: member, discriminant: "vapi") + end + end +end diff --git a/lib/vapi_server_sdk/types/play_ht_credential.rb b/lib/vapi_server_sdk/types/play_ht_credential.rb index b36af7f..a052ac4 100644 --- a/lib/vapi_server_sdk/types/play_ht_credential.rb +++ b/lib/vapi_server_sdk/types/play_ht_credential.rb @@ -18,6 +18,8 @@ class PlayHtCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] attr_reader :user_id # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -34,16 +36,19 @@ class PlayHtCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param user_id [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::PlayHtCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, user_id:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, user_id:, name: OMIT, + additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @user_id = user_id @additional_properties = additional_properties @_field_set = { @@ -53,8 +58,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, user "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, + "name": name, "userId": user_id - } + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of PlayHtCredential @@ -70,6 +78,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] user_id = parsed_json["userId"] new( provider: provider, @@ -78,6 +87,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, user_id: user_id, additional_properties: struct ) @@ -103,6 +113,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/play_ht_voice.rb b/lib/vapi_server_sdk/types/play_ht_voice.rb index f525750..ad6eaca 100644 --- a/lib/vapi_server_sdk/types/play_ht_voice.rb +++ b/lib/vapi_server_sdk/types/play_ht_voice.rb @@ -2,16 +2,15 @@ require_relative "play_ht_voice_id" require_relative "play_ht_voice_emotion" +require_relative "play_ht_voice_model" +require_relative "play_ht_voice_language" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class PlayHtVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::PlayHtVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id # @return [Float] This is the speed multiplier that will be used. @@ -36,9 +35,16 @@ class PlayHtVoice # make the generated speech more accurate to the input text, ensuring that the # words spoken align closely with the provided text. attr_reader :text_guidance + # @return [Vapi::PlayHtVoiceModel] Playht voice model/engine to use. + attr_reader :model + # @return [Vapi::PlayHtVoiceLanguage] The language to use for the speech. + attr_reader :language # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -47,9 +53,6 @@ class PlayHtVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::PlayHtVoiceId] This is the provider-specific ID that will be used. # @param speed [Float] This is the speed multiplier that will be used. # @param temperature [Float] A floating point number between 0, exclusive, and 2, inclusive. If equal to null @@ -67,13 +70,16 @@ class PlayHtVoice # but with a higher chance of deviating from the input text. Higher numbers will # make the generated speech more accurate to the input text, ensuring that the # words spoken align closely with the provided text. + # @param model [Vapi::PlayHtVoiceModel] Playht voice model/engine to use. + # @param language [Vapi::PlayHtVoiceLanguage] The language to use for the speech. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::PlayHtVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT, - voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, chunk_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT + def initialize(voice_id:, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, + style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @speed = speed if speed != OMIT @temperature = temperature if temperature != OMIT @@ -81,10 +87,12 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, temperatu @voice_guidance = voice_guidance if voice_guidance != OMIT @style_guidance = style_guidance if style_guidance != OMIT @text_guidance = text_guidance if text_guidance != OMIT + @model = model if model != OMIT + @language = language if language != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, "speed": speed, "temperature": temperature, @@ -92,7 +100,10 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, temperatu "voiceGuidance": voice_guidance, "styleGuidance": style_guidance, "textGuidance": text_guidance, - "chunkPlan": chunk_plan + "model": model, + "language": language, + "chunkPlan": chunk_plan, + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -105,7 +116,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, speed: OMIT, temperatu def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -118,14 +128,21 @@ def self.from_json(json_object:) voice_guidance = parsed_json["voiceGuidance"] style_guidance = parsed_json["styleGuidance"] text_guidance = parsed_json["textGuidance"] + model = parsed_json["model"] + language = parsed_json["language"] if parsed_json["chunkPlan"].nil? chunk_plan = nil else chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, speed: speed, temperature: temperature, @@ -133,7 +150,10 @@ def self.from_json(json_object:) voice_guidance: voice_guidance, style_guidance: style_guidance, text_guidance: text_guidance, + model: model, + language: language, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -152,7 +172,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::PlayHtVoiceId.validate_raw(obj: obj.voice_id) obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") @@ -160,7 +179,10 @@ def self.validate_raw(obj:) obj.voice_guidance&.is_a?(Float) != false || raise("Passed value for field obj.voice_guidance is not the expected type, validation failed.") obj.style_guidance&.is_a?(Float) != false || raise("Passed value for field obj.style_guidance is not the expected type, validation failed.") obj.text_guidance&.is_a?(Float) != false || raise("Passed value for field obj.text_guidance is not the expected type, validation failed.") + obj.model&.is_a?(Vapi::PlayHtVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.language&.is_a?(Vapi::PlayHtVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/play_ht_voice_language.rb b/lib/vapi_server_sdk/types/play_ht_voice_language.rb new file mode 100644 index 0000000..3067f0d --- /dev/null +++ b/lib/vapi_server_sdk/types/play_ht_voice_language.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Vapi + # The language to use for the speech. + class PlayHtVoiceLanguage + AFRIKAANS = "afrikaans" + ALBANIAN = "albanian" + AMHARIC = "amharic" + ARABIC = "arabic" + BENGALI = "bengali" + BULGARIAN = "bulgarian" + CATALAN = "catalan" + CROATIAN = "croatian" + CZECH = "czech" + DANISH = "danish" + DUTCH = "dutch" + ENGLISH = "english" + FRENCH = "french" + GALICIAN = "galician" + GERMAN = "german" + GREEK = "greek" + HEBREW = "hebrew" + HINDI = "hindi" + HUNGARIAN = "hungarian" + INDONESIAN = "indonesian" + ITALIAN = "italian" + JAPANESE = "japanese" + KOREAN = "korean" + MALAY = "malay" + MANDARIN = "mandarin" + POLISH = "polish" + PORTUGUESE = "portuguese" + RUSSIAN = "russian" + SERBIAN = "serbian" + SPANISH = "spanish" + SWEDISH = "swedish" + TAGALOG = "tagalog" + THAI = "thai" + TURKISH = "turkish" + UKRAINIAN = "ukrainian" + URDU = "urdu" + XHOSA = "xhosa" + end +end diff --git a/lib/vapi_server_sdk/types/play_ht_voice_model.rb b/lib/vapi_server_sdk/types/play_ht_voice_model.rb new file mode 100644 index 0000000..6b85705 --- /dev/null +++ b/lib/vapi_server_sdk/types/play_ht_voice_model.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # Playht voice model/engine to use. + class PlayHtVoiceModel + PLAY_HT_20 = "PlayHT2.0" + PLAY_HT_20_TURBO = "PlayHT2.0-turbo" + PLAY_30_MINI = "Play3.0-mini" + end +end diff --git a/lib/vapi_server_sdk/types/regex_option.rb b/lib/vapi_server_sdk/types/regex_option.rb index 7a282a9..497f588 100644 --- a/lib/vapi_server_sdk/types/regex_option.rb +++ b/lib/vapi_server_sdk/types/regex_option.rb @@ -7,7 +7,7 @@ module Vapi class RegexOption # @return [Vapi::RegexOptionType] This is the type of the regex option. Options are: - # - `ignore-case`: Ignores the case of the text being matched. + # - `ignore-case`: Ignores the case of the text being matched. Add # - `whole-word`: Matches whole words only. # - `multi-line`: Matches across multiple lines. attr_reader :type @@ -23,7 +23,7 @@ class RegexOption OMIT = Object.new # @param type [Vapi::RegexOptionType] This is the type of the regex option. Options are: - # - `ignore-case`: Ignores the case of the text being matched. + # - `ignore-case`: Ignores the case of the text being matched. Add # - `whole-word`: Matches whole words only. # - `multi-line`: Matches across multiple lines. # @param enabled [Boolean] This is whether to enable the option. diff --git a/lib/vapi_server_sdk/types/regex_option_type.rb b/lib/vapi_server_sdk/types/regex_option_type.rb index cf0a9ae..27d129f 100644 --- a/lib/vapi_server_sdk/types/regex_option_type.rb +++ b/lib/vapi_server_sdk/types/regex_option_type.rb @@ -2,7 +2,7 @@ module Vapi # This is the type of the regex option. Options are: - # - `ignore-case`: Ignores the case of the text being matched. + # - `ignore-case`: Ignores the case of the text being matched. Add # - `whole-word`: Matches whole words only. # - `multi-line`: Matches across multiple lines. class RegexOptionType diff --git a/lib/vapi_server_sdk/types/regex_replacement.rb b/lib/vapi_server_sdk/types/regex_replacement.rb index b211c4d..d8f0f04 100644 --- a/lib/vapi_server_sdk/types/regex_replacement.rb +++ b/lib/vapi_server_sdk/types/regex_replacement.rb @@ -7,9 +7,14 @@ module Vapi class RegexReplacement # @return [String] This is the regex pattern to replace. + # Note: + # - This works by using the `string.replace` method in Node.JS. Eg. `"hello + # there".replace(/hello/g, "hi")` will return `"hi there"`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. attr_reader :regex - # @return [Array] These are the options for the regex replacement. Default all options are - # disabled. + # @return [Array] These are the options for the regex replacement. Defaults to all disabled. # @default [] attr_reader :options # @return [String] This is the value that will replace the match. @@ -23,8 +28,13 @@ class RegexReplacement OMIT = Object.new # @param regex [String] This is the regex pattern to replace. - # @param options [Array] These are the options for the regex replacement. Default all options are - # disabled. + # Note: + # - This works by using the `string.replace` method in Node.JS. Eg. `"hello + # there".replace(/hello/g, "hi")` will return `"hi there"`. + # Hot tip: + # - In JavaScript, escape `\` when sending the regex pattern. Eg. `"hello\sthere"` + # will be sent over the wire as `"hellosthere"`. Send `"hello\\sthere"` instead. + # @param options [Array] These are the options for the regex replacement. Defaults to all disabled. # @default [] # @param value [String] This is the value that will replace the match. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition diff --git a/lib/vapi_server_sdk/types/rime_ai_credential.rb b/lib/vapi_server_sdk/types/rime_ai_credential.rb index 57633d7..b695d67 100644 --- a/lib/vapi_server_sdk/types/rime_ai_credential.rb +++ b/lib/vapi_server_sdk/types/rime_ai_credential.rb @@ -18,6 +18,8 @@ class RimeAiCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class RimeAiCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::RimeAiCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of RimeAiCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/rime_ai_voice.rb b/lib/vapi_server_sdk/types/rime_ai_voice.rb index 0eb3450..1a6537b 100644 --- a/lib/vapi_server_sdk/types/rime_ai_voice.rb +++ b/lib/vapi_server_sdk/types/rime_ai_voice.rb @@ -3,15 +3,12 @@ require_relative "rime_ai_voice_id" require_relative "rime_ai_voice_model" require_relative "chunk_plan" +require_relative "fallback_plan" require "ostruct" require "json" module Vapi class RimeAiVoice - # @return [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. - attr_reader :filler_injection_enabled # @return [Vapi::RimeAiVoiceId] This is the provider-specific ID that will be used. attr_reader :voice_id # @return [Vapi::RimeAiVoiceModel] This is the model that will be used. Defaults to 'v1' when not specified. @@ -21,6 +18,9 @@ class RimeAiVoice # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -29,30 +29,29 @@ class RimeAiVoice OMIT = Object.new - # @param filler_injection_enabled [Boolean] This determines whether fillers are injected into the model output before - # inputting it into the voice provider. - # Default `false` because you can achieve better results with prompting the model. # @param voice_id [Vapi::RimeAiVoiceId] This is the provider-specific ID that will be used. # @param model [Vapi::RimeAiVoiceModel] This is the model that will be used. Defaults to 'v1' when not specified. # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::RimeAiVoice] - def initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, speed: OMIT, chunk_plan: OMIT, + def initialize(voice_id:, model: OMIT, speed: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) - @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT @voice_id = voice_id @model = model if model != OMIT @speed = speed if speed != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { - "fillerInjectionEnabled": filler_injection_enabled, "voiceId": voice_id, "model": model, "speed": speed, - "chunkPlan": chunk_plan + "chunkPlan": chunk_plan, + "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end @@ -65,7 +64,6 @@ def initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, speed: OM def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - filler_injection_enabled = parsed_json["fillerInjectionEnabled"] if parsed_json["voiceId"].nil? voice_id = nil else @@ -80,12 +78,18 @@ def self.from_json(json_object:) chunk_plan = parsed_json["chunkPlan"].to_json chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end new( - filler_injection_enabled: filler_injection_enabled, voice_id: voice_id, model: model, speed: speed, chunk_plan: chunk_plan, + fallback_plan: fallback_plan, additional_properties: struct ) end @@ -104,11 +108,11 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") Vapi::RimeAiVoiceId.validate_raw(obj: obj.voice_id) obj.model&.is_a?(Vapi::RimeAiVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end end end diff --git a/lib/vapi_server_sdk/types/runpod_credential.rb b/lib/vapi_server_sdk/types/runpod_credential.rb index d639b8a..eba505c 100644 --- a/lib/vapi_server_sdk/types/runpod_credential.rb +++ b/lib/vapi_server_sdk/types/runpod_credential.rb @@ -18,6 +18,8 @@ class RunpodCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class RunpodCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::RunpodCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of RunpodCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/s_3_credential.rb b/lib/vapi_server_sdk/types/s_3_credential.rb index 156864f..c2a9352 100644 --- a/lib/vapi_server_sdk/types/s_3_credential.rb +++ b/lib/vapi_server_sdk/types/s_3_credential.rb @@ -26,6 +26,8 @@ class S3Credential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -44,10 +46,11 @@ class S3Credential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::S3Credential] def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, - id:, org_id:, created_at:, updated_at:, additional_properties: nil) + id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @aws_access_key_id = aws_access_key_id @aws_secret_access_key = aws_secret_access_key @@ -58,6 +61,7 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -69,8 +73,11 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of S3Credential @@ -90,6 +97,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, aws_access_key_id: aws_access_key_id, @@ -101,6 +109,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -129,6 +138,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/server.rb b/lib/vapi_server_sdk/types/server.rb index 1e3d661..93dc98d 100644 --- a/lib/vapi_server_sdk/types/server.rb +++ b/lib/vapi_server_sdk/types/server.rb @@ -15,6 +15,9 @@ class Server # server. Will be sent as a header called x-vapi-secret. # Same precedence logic as server. attr_reader :secret + # @return [Hash{String => Object}] These are the custom headers to include in the request sent to your server. + # Each key-value pair represents a header name and its value. + attr_reader :headers # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -30,14 +33,22 @@ class Server # @param secret [String] This is the secret you can set that Vapi will send with every request to your # server. Will be sent as a header called x-vapi-secret. # Same precedence logic as server. + # @param headers [Hash{String => Object}] These are the custom headers to include in the request sent to your server. + # Each key-value pair represents a header name and its value. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Server] - def initialize(url:, timeout_seconds: OMIT, secret: OMIT, additional_properties: nil) + def initialize(url:, timeout_seconds: OMIT, secret: OMIT, headers: OMIT, additional_properties: nil) @timeout_seconds = timeout_seconds if timeout_seconds != OMIT @url = url @secret = secret if secret != OMIT + @headers = headers if headers != OMIT @additional_properties = additional_properties - @_field_set = { "timeoutSeconds": timeout_seconds, "url": url, "secret": secret }.reject do |_k, v| + @_field_set = { + "timeoutSeconds": timeout_seconds, + "url": url, + "secret": secret, + "headers": headers + }.reject do |_k, v| v == OMIT end end @@ -52,10 +63,12 @@ def self.from_json(json_object:) timeout_seconds = parsed_json["timeoutSeconds"] url = parsed_json["url"] secret = parsed_json["secret"] + headers = parsed_json["headers"] new( timeout_seconds: timeout_seconds, url: url, secret: secret, + headers: headers, additional_properties: struct ) end @@ -77,6 +90,7 @@ def self.validate_raw(obj:) obj.timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.secret&.is_a?(String) != false || raise("Passed value for field obj.secret is not the expected type, validation failed.") + obj.headers&.is_a?(Hash) != false || raise("Passed value for field obj.headers is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb b/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb index 104e8a3..b166849 100644 --- a/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +++ b/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb @@ -4,32 +4,24 @@ module Vapi # This is the reason the call ended. This can also be found at `call.endedReason` # on GET /call/:id. class ServerMessageEndOfCallReportEndedReason - ASSISTANT_ERROR = "assistant-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - DB_ERROR = "db-error" - NO_SERVER_AVAILABLE = "no-server-available" - LICENSE_CHECK_FAILED = "license-check-failed" - PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" - PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" - PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" - PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" - PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" - PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" - PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" - PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" - PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" - PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED = "pipeline-error-eleven-labs-voice-failed" PIPELINE_ERROR_PLAYHT_VOICE_FAILED = "pipeline-error-playht-voice-failed" PIPELINE_ERROR_LMNT_VOICE_FAILED = "pipeline-error-lmnt-voice-failed" PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" + PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_NO_AVAILABLE_MODEL = "pipeline-no-available-model" WORKER_SHUTDOWN = "worker-shutdown" UNKNOWN_ERROR = "unknown-error" @@ -42,6 +34,16 @@ class ServerMessageEndOfCallReportEndedReason VAPIFAULT_TRANSPORT_NEVER_CONNECTED = "vapifault-transport-never-connected" VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" + VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" + PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" + PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" + PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" + PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" ASSISTANT_NOT_INVALID = "assistant-not-invalid" ASSISTANT_NOT_PROVIDED = "assistant-not-provided" CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" @@ -68,6 +70,21 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA = "pipeline-error-openai-429-exceeded-quota" PIPELINE_ERROR_OPENAI_500_SERVER_ERROR = "pipeline-error-openai-500-server-error" + PIPELINE_ERROR_GOOGLE_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-google-400-bad-request-validation-failed" + PIPELINE_ERROR_GOOGLE_401_UNAUTHORIZED = "pipeline-error-google-401-unauthorized" + PIPELINE_ERROR_GOOGLE_403_MODEL_ACCESS_DENIED = "pipeline-error-google-403-model-access-denied" + PIPELINE_ERROR_GOOGLE_429_EXCEEDED_QUOTA = "pipeline-error-google-429-exceeded-quota" + PIPELINE_ERROR_GOOGLE_500_SERVER_ERROR = "pipeline-error-google-500-server-error" + PIPELINE_ERROR_XAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-xai-400-bad-request-validation-failed" + PIPELINE_ERROR_XAI_401_UNAUTHORIZED = "pipeline-error-xai-401-unauthorized" + PIPELINE_ERROR_XAI_403_MODEL_ACCESS_DENIED = "pipeline-error-xai-403-model-access-denied" + PIPELINE_ERROR_XAI_429_EXCEEDED_QUOTA = "pipeline-error-xai-429-exceeded-quota" + PIPELINE_ERROR_XAI_500_SERVER_ERROR = "pipeline-error-xai-500-server-error" + PIPELINE_ERROR_INFLECTION_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-inflection-ai-400-bad-request-validation-failed" + PIPELINE_ERROR_INFLECTION_AI_401_UNAUTHORIZED = "pipeline-error-inflection-ai-401-unauthorized" + PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" + PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" + PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -83,6 +100,7 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA = "pipeline-error-anthropic-429-exceeded-quota" PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR = "pipeline-error-anthropic-500-server-error" + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-together-ai-400-bad-request-validation-failed" PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED = "pipeline-error-together-ai-401-unauthorized" PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-together-ai-403-model-access-denied" @@ -125,12 +143,12 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA = "pipeline-error-custom-llm-429-exceeded-quota" PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR = "pipeline-error-custom-llm-500-server-error" PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED = "pipeline-error-custom-llm-llm-failed" + PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP = "pipeline-error-cartesia-socket-hang-up" PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT = "pipeline-error-cartesia-requested-payment" PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR = "pipeline-error-cartesia-500-server-error" PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR = "pipeline-error-cartesia-503-server-error" PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR = "pipeline-error-cartesia-522-server-error" - PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND = "pipeline-error-eleven-labs-voice-not-found" PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED = "pipeline-error-eleven-labs-quota-exceeded" PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS = "pipeline-error-eleven-labs-unauthorized-access" @@ -151,10 +169,12 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS = "pipeline-error-eleven-labs-voice-not-allowed-for-free-users" PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR = "pipeline-error-eleven-labs-500-server-error" PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED = "pipeline-error-eleven-labs-max-character-limit-exceeded" + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_VOICE_POTENTIALLY_AGAINST_TERMS_OF_SERVICE_AND_AWAITING_VERIFICATION = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT = "pipeline-error-playht-request-timed-out" PIPELINE_ERROR_PLAYHT_INVALID_VOICE = "pipeline-error-playht-invalid-voice" PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR = "pipeline-error-playht-unexpected-error" PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS = "pipeline-error-playht-out-of-credits" + PIPELINE_ERROR_PLAYHT_INVALID_EMOTION = "pipeline-error-playht-invalid-emotion" PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri" PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED = "pipeline-error-playht-401-unauthorized" PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS = "pipeline-error-playht-403-forbidden-out-of-characters" @@ -162,15 +182,20 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" - PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-403-model-access-denied" - PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND = "pipeline-error-deepgram-404-not-found" - PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-400-no-such-model-language-tier-combination" - PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON = "pipeline-error-deepgram-500-returning-invalid-json" - SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" + PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" + PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" + PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" + PIPELINE_ERROR_DEEPGRAM_RETURNING_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" + SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" TWILIO_REPORTED_CUSTOMER_MISDIALED = "twilio-reported-customer-misdialed" - VOICEMAIL = "voicemail" VONAGE_REJECTED = "vonage-rejected" + VOICEMAIL = "voicemail" end end diff --git a/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb b/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb new file mode 100644 index 0000000..f1aa070 --- /dev/null +++ b/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb @@ -0,0 +1,195 @@ +# frozen_string_literal: true + +require_relative "server_message_knowledge_base_request_phone_number" +require_relative "server_message_knowledge_base_request_messages_item" +require_relative "open_ai_message" +require_relative "artifact" +require_relative "create_assistant_dto" +require_relative "create_customer_dto" +require_relative "call" +require "ostruct" +require "json" + +module Vapi + class ServerMessageKnowledgeBaseRequest + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] This is the phone number associated with the call. + # This matches one of the following: + # - `call.phoneNumber`, + # - `call.phoneNumberId`. + attr_reader :phone_number + # @return [Array] These are the messages that are going to be sent to the `model` right after the + # `knowledge-base-request` webhook completes. + attr_reader :messages + # @return [Array] This is just `messages` formatted for OpenAI. + attr_reader :messages_open_ai_formatted + # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent. + attr_reader :timestamp + # @return [Vapi::Artifact] This is a live version of the `call.artifact`. + # This matches what is stored on `call.artifact` after the call. + attr_reader :artifact + # @return [Vapi::CreateAssistantDto] This is the assistant that is currently active. This is provided for + # convenience. + # This matches one of the following: + # - `call.assistant`, + # - `call.assistantId`, + # - `call.squad[n].assistant`, + # - `call.squad[n].assistantId`, + # - `call.squadId->[n].assistant`, + # - `call.squadId->[n].assistantId`. + attr_reader :assistant + # @return [Vapi::CreateCustomerDto] This is the customer associated with the call. + # This matches one of the following: + # - `call.customer`, + # - `call.customerId`. + attr_reader :customer + # @return [Vapi::Call] This is the call object. + # This matches what was returned in POST /call. + # Note: This might get stale during the call. To get the latest call object, + # especially after the call is ended, use GET /call/:id. + attr_reader :call + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param phone_number [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] This is the phone number associated with the call. + # This matches one of the following: + # - `call.phoneNumber`, + # - `call.phoneNumberId`. + # @param messages [Array] These are the messages that are going to be sent to the `model` right after the + # `knowledge-base-request` webhook completes. + # @param messages_open_ai_formatted [Array] This is just `messages` formatted for OpenAI. + # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent. + # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`. + # This matches what is stored on `call.artifact` after the call. + # @param assistant [Vapi::CreateAssistantDto] This is the assistant that is currently active. This is provided for + # convenience. + # This matches one of the following: + # - `call.assistant`, + # - `call.assistantId`, + # - `call.squad[n].assistant`, + # - `call.squad[n].assistantId`, + # - `call.squadId->[n].assistant`, + # - `call.squadId->[n].assistantId`. + # @param customer [Vapi::CreateCustomerDto] This is the customer associated with the call. + # This matches one of the following: + # - `call.customer`, + # - `call.customerId`. + # @param call [Vapi::Call] This is the call object. + # This matches what was returned in POST /call. + # Note: This might get stale during the call. To get the latest call object, + # especially after the call is ended, use GET /call/:id. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ServerMessageKnowledgeBaseRequest] + def initialize(messages_open_ai_formatted:, phone_number: OMIT, messages: OMIT, timestamp: OMIT, artifact: OMIT, + assistant: OMIT, customer: OMIT, call: OMIT, additional_properties: nil) + @phone_number = phone_number if phone_number != OMIT + @messages = messages if messages != OMIT + @messages_open_ai_formatted = messages_open_ai_formatted + @timestamp = timestamp if timestamp != OMIT + @artifact = artifact if artifact != OMIT + @assistant = assistant if assistant != OMIT + @customer = customer if customer != OMIT + @call = call if call != OMIT + @additional_properties = additional_properties + @_field_set = { + "phoneNumber": phone_number, + "messages": messages, + "messagesOpenAIFormatted": messages_open_ai_formatted, + "timestamp": timestamp, + "artifact": artifact, + "assistant": assistant, + "customer": customer, + "call": call + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of ServerMessageKnowledgeBaseRequest + # + # @param json_object [String] + # @return [Vapi::ServerMessageKnowledgeBaseRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["phoneNumber"].nil? + phone_number = nil + else + phone_number = parsed_json["phoneNumber"].to_json + phone_number = Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber.from_json(json_object: phone_number) + end + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::ServerMessageKnowledgeBaseRequestMessagesItem.from_json(json_object: item) + end + messages_open_ai_formatted = parsed_json["messagesOpenAIFormatted"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + timestamp = parsed_json["timestamp"] + if parsed_json["artifact"].nil? + artifact = nil + else + artifact = parsed_json["artifact"].to_json + artifact = Vapi::Artifact.from_json(json_object: artifact) + end + if parsed_json["assistant"].nil? + assistant = nil + else + assistant = parsed_json["assistant"].to_json + assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant) + end + if parsed_json["customer"].nil? + customer = nil + else + customer = parsed_json["customer"].to_json + customer = Vapi::CreateCustomerDto.from_json(json_object: customer) + end + if parsed_json["call"].nil? + call = nil + else + call = parsed_json["call"].to_json + call = Vapi::Call.from_json(json_object: call) + end + new( + phone_number: phone_number, + messages: messages, + messages_open_ai_formatted: messages_open_ai_formatted, + timestamp: timestamp, + artifact: artifact, + assistant: assistant, + customer: customer, + call: call, + additional_properties: struct + ) + end + + # Serialize an instance of ServerMessageKnowledgeBaseRequest to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.phone_number.nil? || Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber.validate_raw(obj: obj.phone_number) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.messages_open_ai_formatted.is_a?(Array) != false || raise("Passed value for field obj.messages_open_ai_formatted is not the expected type, validation failed.") + obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") + obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact) + obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) + obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) + obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) + end + end +end diff --git a/lib/vapi_server_sdk/types/server_message_knowledge_base_request_messages_item.rb b/lib/vapi_server_sdk/types/server_message_knowledge_base_request_messages_item.rb new file mode 100644 index 0000000..9444a74 --- /dev/null +++ b/lib/vapi_server_sdk/types/server_message_knowledge_base_request_messages_item.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +require "json" +require_relative "user_message" +require_relative "system_message" +require_relative "bot_message" +require_relative "tool_call_message" +require_relative "tool_call_result_message" + +module Vapi + class ServerMessageKnowledgeBaseRequestMessagesItem + # Deserialize a JSON object to an instance of + # ServerMessageKnowledgeBaseRequestMessagesItem + # + # @param json_object [String] + # @return [Vapi::ServerMessageKnowledgeBaseRequestMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + Vapi::UserMessage.validate_raw(obj: struct) + return Vapi::UserMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::SystemMessage.validate_raw(obj: struct) + return Vapi::SystemMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::BotMessage.validate_raw(obj: struct) + return Vapi::BotMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::ToolCallMessage.validate_raw(obj: struct) + return Vapi::ToolCallMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::ToolCallResultMessage.validate_raw(obj: struct) + return Vapi::ToolCallResultMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return Vapi::UserMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::SystemMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::BotMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::ToolCallMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::ToolCallResultMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/server_message_language_changed_phone_number.rb b/lib/vapi_server_sdk/types/server_message_knowledge_base_request_phone_number.rb similarity index 88% rename from lib/vapi_server_sdk/types/server_message_language_changed_phone_number.rb rename to lib/vapi_server_sdk/types/server_message_knowledge_base_request_phone_number.rb index 737f823..db3a49f 100644 --- a/lib/vapi_server_sdk/types/server_message_language_changed_phone_number.rb +++ b/lib/vapi_server_sdk/types/server_message_knowledge_base_request_phone_number.rb @@ -11,7 +11,7 @@ module Vapi # This matches one of the following: # - `call.phoneNumber`, # - `call.phoneNumberId`. - class ServerMessageLanguageChangedPhoneNumber + class ServerMessageKnowledgeBaseRequestPhoneNumber # @return [Object] attr_reader :member # @return [String] @@ -22,17 +22,17 @@ class ServerMessageLanguageChangedPhoneNumber # @param member [Object] # @param discriminant [String] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def initialize(member:, discriminant:) @member = member @discriminant = discriminant end # Deserialize a JSON object to an instance of - # ServerMessageLanguageChangedPhoneNumber + # ServerMessageKnowledgeBaseRequestPhoneNumber # # @param json_object [String] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider @@ -99,25 +99,25 @@ def is_a?(obj) end # @param member [Vapi::CreateByoPhoneNumberDto] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def self.byo_phone_number(member:) new(member: member, discriminant: "byo-phone-number") end # @param member [Vapi::CreateTwilioPhoneNumberDto] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def self.twilio(member:) new(member: member, discriminant: "twilio") end # @param member [Vapi::CreateVonagePhoneNumberDto] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def self.vonage(member:) new(member: member, discriminant: "vonage") end # @param member [Vapi::CreateVapiPhoneNumberDto] - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] + # @return [Vapi::ServerMessageKnowledgeBaseRequestPhoneNumber] def self.vapi(member:) new(member: member, discriminant: "vapi") end diff --git a/lib/vapi_server_sdk/types/server_message_language_changed.rb b/lib/vapi_server_sdk/types/server_message_language_change_detected.rb similarity index 89% rename from lib/vapi_server_sdk/types/server_message_language_changed.rb rename to lib/vapi_server_sdk/types/server_message_language_change_detected.rb index fe3ab74..928d104 100644 --- a/lib/vapi_server_sdk/types/server_message_language_changed.rb +++ b/lib/vapi_server_sdk/types/server_message_language_change_detected.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "server_message_language_changed_phone_number" +require_relative "server_message_language_change_detected_phone_number" require_relative "artifact" require_relative "create_assistant_dto" require_relative "create_customer_dto" @@ -9,8 +9,8 @@ require "json" module Vapi - class ServerMessageLanguageChanged - # @return [Vapi::ServerMessageLanguageChangedPhoneNumber] This is the phone number associated with the call. + class ServerMessageLanguageChangeDetected + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] This is the phone number associated with the call. # This matches one of the following: # - `call.phoneNumber`, # - `call.phoneNumberId`. @@ -50,7 +50,7 @@ class ServerMessageLanguageChanged OMIT = Object.new - # @param phone_number [Vapi::ServerMessageLanguageChangedPhoneNumber] This is the phone number associated with the call. + # @param phone_number [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] This is the phone number associated with the call. # This matches one of the following: # - `call.phoneNumber`, # - `call.phoneNumberId`. @@ -76,7 +76,7 @@ class ServerMessageLanguageChanged # especially after the call is ended, use GET /call/:id. # @param language [String] This is the language the transcriber is switched to. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::ServerMessageLanguageChanged] + # @return [Vapi::ServerMessageLanguageChangeDetected] def initialize(language:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @@ -100,10 +100,10 @@ def initialize(language:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, a end end - # Deserialize a JSON object to an instance of ServerMessageLanguageChanged + # Deserialize a JSON object to an instance of ServerMessageLanguageChangeDetected # # @param json_object [String] - # @return [Vapi::ServerMessageLanguageChanged] + # @return [Vapi::ServerMessageLanguageChangeDetected] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) @@ -111,7 +111,7 @@ def self.from_json(json_object:) phone_number = nil else phone_number = parsed_json["phoneNumber"].to_json - phone_number = Vapi::ServerMessageLanguageChangedPhoneNumber.from_json(json_object: phone_number) + phone_number = Vapi::ServerMessageLanguageChangeDetectedPhoneNumber.from_json(json_object: phone_number) end timestamp = parsed_json["timestamp"] if parsed_json["artifact"].nil? @@ -151,7 +151,7 @@ def self.from_json(json_object:) ) end - # Serialize an instance of ServerMessageLanguageChanged to a JSON object + # Serialize an instance of ServerMessageLanguageChangeDetected to a JSON object # # @return [String] def to_json(*_args) @@ -165,7 +165,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.phone_number.nil? || Vapi::ServerMessageLanguageChangedPhoneNumber.validate_raw(obj: obj.phone_number) + obj.phone_number.nil? || Vapi::ServerMessageLanguageChangeDetectedPhoneNumber.validate_raw(obj: obj.phone_number) obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact) obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) diff --git a/lib/vapi_server_sdk/types/server_message_language_change_detected_phone_number.rb b/lib/vapi_server_sdk/types/server_message_language_change_detected_phone_number.rb new file mode 100644 index 0000000..2f5bcd5 --- /dev/null +++ b/lib/vapi_server_sdk/types/server_message_language_change_detected_phone_number.rb @@ -0,0 +1,125 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_byo_phone_number_dto" +require_relative "create_twilio_phone_number_dto" +require_relative "create_vonage_phone_number_dto" +require_relative "create_vapi_phone_number_dto" + +module Vapi + # This is the phone number associated with the call. + # This matches one of the following: + # - `call.phoneNumber`, + # - `call.phoneNumberId`. + class ServerMessageLanguageChangeDetectedPhoneNumber + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # ServerMessageLanguageChangeDetectedPhoneNumber + # + # @param json_object [String] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "byo-phone-number" + Vapi::CreateByoPhoneNumberDto.from_json(json_object: json_object) + when "twilio" + Vapi::CreateTwilioPhoneNumberDto.from_json(json_object: json_object) + when "vonage" + Vapi::CreateVonagePhoneNumberDto.from_json(json_object: json_object) + when "vapi" + Vapi::CreateVapiPhoneNumberDto.from_json(json_object: json_object) + else + Vapi::CreateByoPhoneNumberDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "byo-phone-number" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "vapi" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "byo-phone-number" + Vapi::CreateByoPhoneNumberDto.validate_raw(obj: obj) + when "twilio" + Vapi::CreateTwilioPhoneNumberDto.validate_raw(obj: obj) + when "vonage" + Vapi::CreateVonagePhoneNumberDto.validate_raw(obj: obj) + when "vapi" + Vapi::CreateVapiPhoneNumberDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateByoPhoneNumberDto] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def self.byo_phone_number(member:) + new(member: member, discriminant: "byo-phone-number") + end + + # @param member [Vapi::CreateTwilioPhoneNumberDto] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::CreateVonagePhoneNumberDto] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::CreateVapiPhoneNumberDto] + # @return [Vapi::ServerMessageLanguageChangeDetectedPhoneNumber] + def self.vapi(member:) + new(member: member, discriminant: "vapi") + end + end +end diff --git a/lib/vapi_server_sdk/types/server_message_message.rb b/lib/vapi_server_sdk/types/server_message_message.rb index ebe0997..4fbf26d 100644 --- a/lib/vapi_server_sdk/types/server_message_message.rb +++ b/lib/vapi_server_sdk/types/server_message_message.rb @@ -5,6 +5,7 @@ require_relative "server_message_conversation_update" require_relative "server_message_end_of_call_report" require_relative "server_message_hang" +require_relative "server_message_knowledge_base_request" require_relative "server_message_model_output" require_relative "server_message_phone_call_control" require_relative "server_message_speech_update" @@ -14,7 +15,7 @@ require_relative "server_message_transfer_update" require_relative "server_message_transcript" require_relative "server_message_user_interrupted" -require_relative "server_message_language_changed" +require_relative "server_message_language_change_detected" require_relative "server_message_voice_input" require_relative "server_message_voice_request" @@ -60,6 +61,8 @@ def self.from_json(json_object:) Vapi::ServerMessageEndOfCallReport.from_json(json_object: json_object) when "hang" Vapi::ServerMessageHang.from_json(json_object: json_object) + when "knowledge-base-request" + Vapi::ServerMessageKnowledgeBaseRequest.from_json(json_object: json_object) when "model-output" Vapi::ServerMessageModelOutput.from_json(json_object: json_object) when "phone-call-control" @@ -78,8 +81,8 @@ def self.from_json(json_object:) Vapi::ServerMessageTranscript.from_json(json_object: json_object) when "user-interrupted" Vapi::ServerMessageUserInterrupted.from_json(json_object: json_object) - when "language-changed" - Vapi::ServerMessageLanguageChanged.from_json(json_object: json_object) + when "language-change-detected" + Vapi::ServerMessageLanguageChangeDetected.from_json(json_object: json_object) when "voice-input" Vapi::ServerMessageVoiceInput.from_json(json_object: json_object) when "voice-request" @@ -103,6 +106,8 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "hang" { **@member.to_json, type: @discriminant }.to_json + when "knowledge-base-request" + { **@member.to_json, type: @discriminant }.to_json when "model-output" { **@member.to_json, type: @discriminant }.to_json when "phone-call-control" @@ -121,7 +126,7 @@ def to_json(*_args) { **@member.to_json, type: @discriminant }.to_json when "user-interrupted" { **@member.to_json, type: @discriminant }.to_json - when "language-changed" + when "language-change-detected" { **@member.to_json, type: @discriminant }.to_json when "voice-input" { **@member.to_json, type: @discriminant }.to_json @@ -149,6 +154,8 @@ def self.validate_raw(obj:) Vapi::ServerMessageEndOfCallReport.validate_raw(obj: obj) when "hang" Vapi::ServerMessageHang.validate_raw(obj: obj) + when "knowledge-base-request" + Vapi::ServerMessageKnowledgeBaseRequest.validate_raw(obj: obj) when "model-output" Vapi::ServerMessageModelOutput.validate_raw(obj: obj) when "phone-call-control" @@ -167,8 +174,8 @@ def self.validate_raw(obj:) Vapi::ServerMessageTranscript.validate_raw(obj: obj) when "user-interrupted" Vapi::ServerMessageUserInterrupted.validate_raw(obj: obj) - when "language-changed" - Vapi::ServerMessageLanguageChanged.validate_raw(obj: obj) + when "language-change-detected" + Vapi::ServerMessageLanguageChangeDetected.validate_raw(obj: obj) when "voice-input" Vapi::ServerMessageVoiceInput.validate_raw(obj: obj) when "voice-request" @@ -210,6 +217,12 @@ def self.hang(member:) new(member: member, discriminant: "hang") end + # @param member [Vapi::ServerMessageKnowledgeBaseRequest] + # @return [Vapi::ServerMessageMessage] + def self.knowledge_base_request(member:) + new(member: member, discriminant: "knowledge-base-request") + end + # @param member [Vapi::ServerMessageModelOutput] # @return [Vapi::ServerMessageMessage] def self.model_output(member:) @@ -264,10 +277,10 @@ def self.user_interrupted(member:) new(member: member, discriminant: "user-interrupted") end - # @param member [Vapi::ServerMessageLanguageChanged] + # @param member [Vapi::ServerMessageLanguageChangeDetected] # @return [Vapi::ServerMessageMessage] - def self.language_changed(member:) - new(member: member, discriminant: "language-changed") + def self.language_change_detected(member:) + new(member: member, discriminant: "language-change-detected") end # @param member [Vapi::ServerMessageVoiceInput] diff --git a/lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb b/lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb new file mode 100644 index 0000000..34ee664 --- /dev/null +++ b/lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +require_relative "knowledge_base_response_document" +require_relative "custom_message" +require "ostruct" +require "json" + +module Vapi + class ServerMessageResponseKnowledgeBaseRequest + # @return [Array] This is the list of documents that will be sent to the model alongside the + # `messages` to generate a response. + attr_reader :documents + # @return [Vapi::CustomMessage] This can be used to skip the model output generation and speak a custom message. + attr_reader :message + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param documents [Array] This is the list of documents that will be sent to the model alongside the + # `messages` to generate a response. + # @param message [Vapi::CustomMessage] This can be used to skip the model output generation and speak a custom message. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ServerMessageResponseKnowledgeBaseRequest] + def initialize(documents: OMIT, message: OMIT, additional_properties: nil) + @documents = documents if documents != OMIT + @message = message if message != OMIT + @additional_properties = additional_properties + @_field_set = { "documents": documents, "message": message }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of + # ServerMessageResponseKnowledgeBaseRequest + # + # @param json_object [String] + # @return [Vapi::ServerMessageResponseKnowledgeBaseRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + documents = parsed_json["documents"]&.map do |item| + item = item.to_json + Vapi::KnowledgeBaseResponseDocument.from_json(json_object: item) + end + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::CustomMessage.from_json(json_object: message) + end + new( + documents: documents, + message: message, + additional_properties: struct + ) + end + + # Serialize an instance of ServerMessageResponseKnowledgeBaseRequest to a JSON + # object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.documents&.is_a?(Array) != false || raise("Passed value for field obj.documents is not the expected type, validation failed.") + obj.message.nil? || Vapi::CustomMessage.validate_raw(obj: obj.message) + end + end +end diff --git a/lib/vapi_server_sdk/types/server_message_response_message_response.rb b/lib/vapi_server_sdk/types/server_message_response_message_response.rb index 26b6bd3..d22a9bd 100644 --- a/lib/vapi_server_sdk/types/server_message_response_message_response.rb +++ b/lib/vapi_server_sdk/types/server_message_response_message_response.rb @@ -2,6 +2,7 @@ require "json" require_relative "server_message_response_assistant_request" +require_relative "server_message_response_knowledge_base_request" require_relative "server_message_response_tool_calls" require_relative "server_message_response_transfer_destination_request" require_relative "server_message_response_voice_request" @@ -25,6 +26,14 @@ def self.from_json(json_object:) rescue StandardError # noop end + begin + Vapi::ServerMessageResponseKnowledgeBaseRequest.validate_raw(obj: struct) + return Vapi::ServerMessageResponseKnowledgeBaseRequest.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end begin Vapi::ServerMessageResponseToolCalls.validate_raw(obj: struct) return Vapi::ServerMessageResponseToolCalls.from_json(json_object: struct) unless struct.nil? @@ -64,6 +73,11 @@ def self.validate_raw(obj:) rescue StandardError # noop end + begin + return Vapi::ServerMessageResponseKnowledgeBaseRequest.validate_raw(obj: obj) + rescue StandardError + # noop + end begin return Vapi::ServerMessageResponseToolCalls.validate_raw(obj: obj) rescue StandardError diff --git a/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb b/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb index 7661a16..19f659d 100644 --- a/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +++ b/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb @@ -3,32 +3,24 @@ module Vapi # This is the reason the call ended. This is only sent if the status is "ended". class ServerMessageStatusUpdateEndedReason - ASSISTANT_ERROR = "assistant-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - DB_ERROR = "db-error" - NO_SERVER_AVAILABLE = "no-server-available" - LICENSE_CHECK_FAILED = "license-check-failed" - PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" - PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" - PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" - PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" - PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" - PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" - PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" - PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" - PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" - PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED = "pipeline-error-eleven-labs-voice-failed" PIPELINE_ERROR_PLAYHT_VOICE_FAILED = "pipeline-error-playht-voice-failed" PIPELINE_ERROR_LMNT_VOICE_FAILED = "pipeline-error-lmnt-voice-failed" PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED = "pipeline-error-vapi-403-model-access-denied" + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA = "pipeline-error-vapi-429-exceeded-quota" + PIPELINE_ERROR_VAPI_500_SERVER_ERROR = "pipeline-error-vapi-500-server-error" PIPELINE_NO_AVAILABLE_MODEL = "pipeline-no-available-model" WORKER_SHUTDOWN = "worker-shutdown" UNKNOWN_ERROR = "unknown-error" @@ -41,6 +33,16 @@ class ServerMessageStatusUpdateEndedReason VAPIFAULT_TRANSPORT_NEVER_CONNECTED = "vapifault-transport-never-connected" VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" + VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" + PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" + PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" + PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" + PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" ASSISTANT_NOT_INVALID = "assistant-not-invalid" ASSISTANT_NOT_PROVIDED = "assistant-not-provided" CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" @@ -67,6 +69,21 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA = "pipeline-error-openai-429-exceeded-quota" PIPELINE_ERROR_OPENAI_500_SERVER_ERROR = "pipeline-error-openai-500-server-error" + PIPELINE_ERROR_GOOGLE_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-google-400-bad-request-validation-failed" + PIPELINE_ERROR_GOOGLE_401_UNAUTHORIZED = "pipeline-error-google-401-unauthorized" + PIPELINE_ERROR_GOOGLE_403_MODEL_ACCESS_DENIED = "pipeline-error-google-403-model-access-denied" + PIPELINE_ERROR_GOOGLE_429_EXCEEDED_QUOTA = "pipeline-error-google-429-exceeded-quota" + PIPELINE_ERROR_GOOGLE_500_SERVER_ERROR = "pipeline-error-google-500-server-error" + PIPELINE_ERROR_XAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-xai-400-bad-request-validation-failed" + PIPELINE_ERROR_XAI_401_UNAUTHORIZED = "pipeline-error-xai-401-unauthorized" + PIPELINE_ERROR_XAI_403_MODEL_ACCESS_DENIED = "pipeline-error-xai-403-model-access-denied" + PIPELINE_ERROR_XAI_429_EXCEEDED_QUOTA = "pipeline-error-xai-429-exceeded-quota" + PIPELINE_ERROR_XAI_500_SERVER_ERROR = "pipeline-error-xai-500-server-error" + PIPELINE_ERROR_INFLECTION_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-inflection-ai-400-bad-request-validation-failed" + PIPELINE_ERROR_INFLECTION_AI_401_UNAUTHORIZED = "pipeline-error-inflection-ai-401-unauthorized" + PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" + PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" + PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -82,6 +99,7 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA = "pipeline-error-anthropic-429-exceeded-quota" PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR = "pipeline-error-anthropic-500-server-error" + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED = "pipeline-error-anthropic-llm-failed" PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-together-ai-400-bad-request-validation-failed" PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED = "pipeline-error-together-ai-401-unauthorized" PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-together-ai-403-model-access-denied" @@ -124,12 +142,12 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA = "pipeline-error-custom-llm-429-exceeded-quota" PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR = "pipeline-error-custom-llm-500-server-error" PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED = "pipeline-error-custom-llm-llm-failed" + PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP = "pipeline-error-cartesia-socket-hang-up" PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT = "pipeline-error-cartesia-requested-payment" PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR = "pipeline-error-cartesia-500-server-error" PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR = "pipeline-error-cartesia-503-server-error" PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR = "pipeline-error-cartesia-522-server-error" - PIPELINE_ERROR_CUSTOM_VOICE_FAILED = "pipeline-error-custom-voice-failed" PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND = "pipeline-error-eleven-labs-voice-not-found" PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED = "pipeline-error-eleven-labs-quota-exceeded" PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS = "pipeline-error-eleven-labs-unauthorized-access" @@ -150,10 +168,12 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS = "pipeline-error-eleven-labs-voice-not-allowed-for-free-users" PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR = "pipeline-error-eleven-labs-500-server-error" PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED = "pipeline-error-eleven-labs-max-character-limit-exceeded" + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_VOICE_POTENTIALLY_AGAINST_TERMS_OF_SERVICE_AND_AWAITING_VERIFICATION = "pipeline-error-eleven-labs-blocked-voice-potentially-against-terms-of-service-and-awaiting-verification" PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT = "pipeline-error-playht-request-timed-out" PIPELINE_ERROR_PLAYHT_INVALID_VOICE = "pipeline-error-playht-invalid-voice" PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR = "pipeline-error-playht-unexpected-error" PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS = "pipeline-error-playht-out-of-credits" + PIPELINE_ERROR_PLAYHT_INVALID_EMOTION = "pipeline-error-playht-invalid-emotion" PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI = "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri" PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED = "pipeline-error-playht-401-unauthorized" PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS = "pipeline-error-playht-403-forbidden-out-of-characters" @@ -161,15 +181,20 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" - PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-403-model-access-denied" - PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND = "pipeline-error-deepgram-404-not-found" - PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-400-no-such-model-language-tier-combination" - PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON = "pipeline-error-deepgram-500-returning-invalid-json" - SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" + PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" + PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" + PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" + PIPELINE_ERROR_DEEPGRAM_RETURNING_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION = "pipeline-error-deepgram-returning-400-no-such-model-language-tier-combination" + PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" + PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" + SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" TWILIO_REPORTED_CUSTOMER_MISDIALED = "twilio-reported-customer-misdialed" - VOICEMAIL = "voicemail" VONAGE_REJECTED = "vonage-rejected" + VOICEMAIL = "voicemail" end end diff --git a/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb b/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb index 8fdca6f..776bd7c 100644 --- a/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb +++ b/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb @@ -7,22 +7,6 @@ module Vapi class ServerMessageToolCallsToolWithToolCallListItem - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::ServerMessageToolCallsToolWithToolCallListItem] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - # Deserialize a JSON object to an instance of # ServerMessageToolCallsToolWithToolCallListItem # @@ -30,34 +14,55 @@ def initialize(member:, discriminant:) # @return [Vapi::ServerMessageToolCallsToolWithToolCallListItem] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "function" - Vapi::FunctionToolWithToolCall.from_json(json_object: json_object) - when "ghl" - Vapi::GhlToolWithToolCall.from_json(json_object: json_object) - when "make" - Vapi::MakeToolWithToolCall.from_json(json_object: json_object) - else - Vapi::FunctionToolWithToolCall.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end + begin + Vapi::FunctionToolWithToolCall.validate_raw(obj: struct) + return Vapi::FunctionToolWithToolCall.from_json(json_object: struct) unless struct.nil? - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "function" - { **@member.to_json, type: @discriminant }.to_json - when "ghl" - { **@member.to_json, type: @discriminant }.to_json - when "make" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json + return nil + rescue StandardError + # noop + end + begin + Vapi::GhlToolWithToolCall.validate_raw(obj: struct) + return Vapi::GhlToolWithToolCall.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop end - @member.to_json + begin + Vapi::MakeToolWithToolCall.validate_raw(obj: struct) + return Vapi::MakeToolWithToolCall.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct end # Leveraged for Union-type generation, validate_raw attempts to parse the given @@ -67,42 +72,37 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - case obj.type - when "function" - Vapi::FunctionToolWithToolCall.validate_raw(obj: obj) - when "ghl" - Vapi::GhlToolWithToolCall.validate_raw(obj: obj) - when "make" - Vapi::MakeToolWithToolCall.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") + begin + return Vapi::FunctionToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::FunctionToolWithToolCall] - # @return [Vapi::ServerMessageToolCallsToolWithToolCallListItem] - def self.function(member:) - new(member: member, discriminant: "function") - end - - # @param member [Vapi::GhlToolWithToolCall] - # @return [Vapi::ServerMessageToolCallsToolWithToolCallListItem] - def self.ghl(member:) - new(member: member, discriminant: "ghl") - end - - # @param member [Vapi::MakeToolWithToolCall] - # @return [Vapi::ServerMessageToolCallsToolWithToolCallListItem] - def self.make(member:) - new(member: member, discriminant: "make") + begin + return Vapi::GhlToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return Vapi::MakeToolWithToolCall.validate_raw(obj: obj) + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/server_message_transfer_update.rb b/lib/vapi_server_sdk/types/server_message_transfer_update.rb index 4b76acd..ce23ccd 100644 --- a/lib/vapi_server_sdk/types/server_message_transfer_update.rb +++ b/lib/vapi_server_sdk/types/server_message_transfer_update.rb @@ -49,6 +49,10 @@ class ServerMessageTransferUpdate # @return [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred from. This is only sent # if `destination.type` is "assistant". attr_reader :from_assistant + # @return [Hash{String => Object}] This is the step that the conversation moved to. + attr_reader :to_step_record + # @return [Hash{String => Object}] This is the step that the conversation moved from. = + attr_reader :from_step_record # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -86,10 +90,12 @@ class ServerMessageTransferUpdate # if `destination.type` is "assistant". # @param from_assistant [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred from. This is only sent # if `destination.type` is "assistant". + # @param to_step_record [Hash{String => Object}] This is the step that the conversation moved to. + # @param from_step_record [Hash{String => Object}] This is the step that the conversation moved from. = # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ServerMessageTransferUpdate] def initialize(phone_number: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, - customer: OMIT, call: OMIT, to_assistant: OMIT, from_assistant: OMIT, additional_properties: nil) + customer: OMIT, call: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, from_step_record: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @destination = destination if destination != OMIT @timestamp = timestamp if timestamp != OMIT @@ -99,6 +105,8 @@ def initialize(phone_number: OMIT, destination: OMIT, timestamp: OMIT, artifact: @call = call if call != OMIT @to_assistant = to_assistant if to_assistant != OMIT @from_assistant = from_assistant if from_assistant != OMIT + @to_step_record = to_step_record if to_step_record != OMIT + @from_step_record = from_step_record if from_step_record != OMIT @additional_properties = additional_properties @_field_set = { "phoneNumber": phone_number, @@ -109,7 +117,9 @@ def initialize(phone_number: OMIT, destination: OMIT, timestamp: OMIT, artifact: "customer": customer, "call": call, "toAssistant": to_assistant, - "fromAssistant": from_assistant + "fromAssistant": from_assistant, + "toStepRecord": to_step_record, + "fromStepRecord": from_step_record }.reject do |_k, v| v == OMIT end @@ -171,6 +181,8 @@ def self.from_json(json_object:) from_assistant = parsed_json["fromAssistant"].to_json from_assistant = Vapi::CreateAssistantDto.from_json(json_object: from_assistant) end + to_step_record = parsed_json["toStepRecord"] + from_step_record = parsed_json["fromStepRecord"] new( phone_number: phone_number, destination: destination, @@ -181,6 +193,8 @@ def self.from_json(json_object:) call: call, to_assistant: to_assistant, from_assistant: from_assistant, + to_step_record: to_step_record, + from_step_record: from_step_record, additional_properties: struct ) end @@ -208,6 +222,8 @@ def self.validate_raw(obj:) obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) obj.to_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.to_assistant) obj.from_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.from_assistant) + obj.to_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.to_step_record is not the expected type, validation failed.") + obj.from_step_record&.is_a?(Hash) != false || raise("Passed value for field obj.from_step_record is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/sip_authentication.rb b/lib/vapi_server_sdk/types/sip_authentication.rb new file mode 100644 index 0000000..db38635 --- /dev/null +++ b/lib/vapi_server_sdk/types/sip_authentication.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class SipAuthentication + # @return [String] This will be expected in the `realm` field of the `authorization` header of the + # SIP INVITE. Defaults to sip.vapi.ai. + attr_reader :realm + # @return [String] This will be expected in the `username` field of the `authorization` header of + # the SIP INVITE. + attr_reader :username + # @return [String] This will be expected to generate the `response` field of the `authorization` + # header of the SIP INVITE, through digest authentication. + attr_reader :password + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param realm [String] This will be expected in the `realm` field of the `authorization` header of the + # SIP INVITE. Defaults to sip.vapi.ai. + # @param username [String] This will be expected in the `username` field of the `authorization` header of + # the SIP INVITE. + # @param password [String] This will be expected to generate the `response` field of the `authorization` + # header of the SIP INVITE, through digest authentication. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SipAuthentication] + def initialize(username:, password:, realm: OMIT, additional_properties: nil) + @realm = realm if realm != OMIT + @username = username + @password = password + @additional_properties = additional_properties + @_field_set = { "realm": realm, "username": username, "password": password }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of SipAuthentication + # + # @param json_object [String] + # @return [Vapi::SipAuthentication] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + realm = parsed_json["realm"] + username = parsed_json["username"] + password = parsed_json["password"] + new( + realm: realm, + username: username, + password: password, + additional_properties: struct + ) + end + + # Serialize an instance of SipAuthentication to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.realm&.is_a?(String) != false || raise("Passed value for field obj.realm is not the expected type, validation failed.") + obj.username.is_a?(String) != false || raise("Passed value for field obj.username is not the expected type, validation failed.") + obj.password.is_a?(String) != false || raise("Passed value for field obj.password is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/start_speaking_plan.rb b/lib/vapi_server_sdk/types/start_speaking_plan.rb index f415d8a..ce1841f 100644 --- a/lib/vapi_server_sdk/types/start_speaking_plan.rb +++ b/lib/vapi_server_sdk/types/start_speaking_plan.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "start_speaking_plan_custom_endpointing_rules_item" require_relative "transcription_endpointing_plan" require "ostruct" require "json" @@ -8,7 +9,7 @@ module Vapi class StartSpeakingPlan # @return [Float] This is how long assistant waits before speaking. Defaults to 0.4. # This is the minimum it will wait but if there is latency is the pipeline, this - # minimum will be exceeded. This is really a stopgap in case the pipeline is + # minimum will be exceeded. This is intended as a stopgap in case the pipeline is # moving too fast. # Example: # - If model generates tokens and voice generates bytes within 100ms, the pipeline @@ -19,12 +20,30 @@ class StartSpeakingPlan # value. # @default 0.4 attr_reader :wait_seconds - # @return [Boolean] This determines if a customer speech is considered done (endpointing) using the - # VAP model on customer's speech. This is good for middle-of-thought detection. + # @return [Boolean] This determines if a customer speech is considered done (endpointing) using a + # Vapi custom-trained model on customer's speech. This is good for + # middle-of-thought detection. # Once an endpoint is triggered, the request is sent to `assistant.model`. - # Default `false` since experimental. + # Usage: + # - If your conversations are long-form and you want assistant to wait smartly + # even if customer pauses for a bit to think, you can use this instead. + # This overrides `transcriptionEndpointingPlan`. # @default false attr_reader :smart_endpointing_enabled + # @return [Array] These are the custom endpointing rules to set an endpointing timeout based on a + # regex on the customer's speech or the assistant's last message. + # Usage: + # - If you have yes/no questions like "are you interested in a loan?", you can set + # a shorter timeout. + # - If you have questions where the customer may pause to look up information like + # "what's my account number?", you can set a longer timeout. + # - If you want to wait longer while customer is enumerating a list of numbers, + # you can set a longer timeout. + # These override `transcriptionEndpointingPlan` and `smartEndpointingEnabled` when + # a rule is matched. + # The rules are evaluated in order and the first one that matches will be used. + # @default [] + attr_reader :custom_endpointing_rules # @return [Vapi::TranscriptionEndpointingPlan] This determines how a customer speech is considered done (endpointing) using the # transcription of customer's speech. # Once an endpoint is triggered, the request is sent to `assistant.model`. @@ -39,7 +58,7 @@ class StartSpeakingPlan # @param wait_seconds [Float] This is how long assistant waits before speaking. Defaults to 0.4. # This is the minimum it will wait but if there is latency is the pipeline, this - # minimum will be exceeded. This is really a stopgap in case the pipeline is + # minimum will be exceeded. This is intended as a stopgap in case the pipeline is # moving too fast. # Example: # - If model generates tokens and voice generates bytes within 100ms, the pipeline @@ -49,25 +68,44 @@ class StartSpeakingPlan # - If the assistant is accidentally jumping in too much, set this to a higher # value. # @default 0.4 - # @param smart_endpointing_enabled [Boolean] This determines if a customer speech is considered done (endpointing) using the - # VAP model on customer's speech. This is good for middle-of-thought detection. + # @param smart_endpointing_enabled [Boolean] This determines if a customer speech is considered done (endpointing) using a + # Vapi custom-trained model on customer's speech. This is good for + # middle-of-thought detection. # Once an endpoint is triggered, the request is sent to `assistant.model`. - # Default `false` since experimental. + # Usage: + # - If your conversations are long-form and you want assistant to wait smartly + # even if customer pauses for a bit to think, you can use this instead. + # This overrides `transcriptionEndpointingPlan`. # @default false + # @param custom_endpointing_rules [Array] These are the custom endpointing rules to set an endpointing timeout based on a + # regex on the customer's speech or the assistant's last message. + # Usage: + # - If you have yes/no questions like "are you interested in a loan?", you can set + # a shorter timeout. + # - If you have questions where the customer may pause to look up information like + # "what's my account number?", you can set a longer timeout. + # - If you want to wait longer while customer is enumerating a list of numbers, + # you can set a longer timeout. + # These override `transcriptionEndpointingPlan` and `smartEndpointingEnabled` when + # a rule is matched. + # The rules are evaluated in order and the first one that matches will be used. + # @default [] # @param transcription_endpointing_plan [Vapi::TranscriptionEndpointingPlan] This determines how a customer speech is considered done (endpointing) using the # transcription of customer's speech. # Once an endpoint is triggered, the request is sent to `assistant.model`. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::StartSpeakingPlan] - def initialize(wait_seconds: OMIT, smart_endpointing_enabled: OMIT, transcription_endpointing_plan: OMIT, - additional_properties: nil) + def initialize(wait_seconds: OMIT, smart_endpointing_enabled: OMIT, custom_endpointing_rules: OMIT, + transcription_endpointing_plan: OMIT, additional_properties: nil) @wait_seconds = wait_seconds if wait_seconds != OMIT @smart_endpointing_enabled = smart_endpointing_enabled if smart_endpointing_enabled != OMIT + @custom_endpointing_rules = custom_endpointing_rules if custom_endpointing_rules != OMIT @transcription_endpointing_plan = transcription_endpointing_plan if transcription_endpointing_plan != OMIT @additional_properties = additional_properties @_field_set = { "waitSeconds": wait_seconds, "smartEndpointingEnabled": smart_endpointing_enabled, + "customEndpointingRules": custom_endpointing_rules, "transcriptionEndpointingPlan": transcription_endpointing_plan }.reject do |_k, v| v == OMIT @@ -83,6 +121,10 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) wait_seconds = parsed_json["waitSeconds"] smart_endpointing_enabled = parsed_json["smartEndpointingEnabled"] + custom_endpointing_rules = parsed_json["customEndpointingRules"]&.map do |item| + item = item.to_json + Vapi::StartSpeakingPlanCustomEndpointingRulesItem.from_json(json_object: item) + end if parsed_json["transcriptionEndpointingPlan"].nil? transcription_endpointing_plan = nil else @@ -92,6 +134,7 @@ def self.from_json(json_object:) new( wait_seconds: wait_seconds, smart_endpointing_enabled: smart_endpointing_enabled, + custom_endpointing_rules: custom_endpointing_rules, transcription_endpointing_plan: transcription_endpointing_plan, additional_properties: struct ) @@ -113,6 +156,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.wait_seconds&.is_a?(Float) != false || raise("Passed value for field obj.wait_seconds is not the expected type, validation failed.") obj.smart_endpointing_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.smart_endpointing_enabled is not the expected type, validation failed.") + obj.custom_endpointing_rules&.is_a?(Array) != false || raise("Passed value for field obj.custom_endpointing_rules is not the expected type, validation failed.") obj.transcription_endpointing_plan.nil? || Vapi::TranscriptionEndpointingPlan.validate_raw(obj: obj.transcription_endpointing_plan) end end diff --git a/lib/vapi_server_sdk/types/start_speaking_plan_custom_endpointing_rules_item.rb b/lib/vapi_server_sdk/types/start_speaking_plan_custom_endpointing_rules_item.rb new file mode 100644 index 0000000..a3eda25 --- /dev/null +++ b/lib/vapi_server_sdk/types/start_speaking_plan_custom_endpointing_rules_item.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +require "json" +require_relative "assistant_custom_endpointing_rule" +require_relative "customer_custom_endpointing_rule" +require_relative "both_custom_endpointing_rule" + +module Vapi + class StartSpeakingPlanCustomEndpointingRulesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::StartSpeakingPlanCustomEndpointingRulesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # StartSpeakingPlanCustomEndpointingRulesItem + # + # @param json_object [String] + # @return [Vapi::StartSpeakingPlanCustomEndpointingRulesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "assistant" + Vapi::AssistantCustomEndpointingRule.from_json(json_object: json_object) + when "customer" + Vapi::CustomerCustomEndpointingRule.from_json(json_object: json_object) + when "both" + Vapi::BothCustomEndpointingRule.from_json(json_object: json_object) + else + Vapi::AssistantCustomEndpointingRule.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "assistant" + { **@member.to_json, type: @discriminant }.to_json + when "customer" + { **@member.to_json, type: @discriminant }.to_json + when "both" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "assistant" + Vapi::AssistantCustomEndpointingRule.validate_raw(obj: obj) + when "customer" + Vapi::CustomerCustomEndpointingRule.validate_raw(obj: obj) + when "both" + Vapi::BothCustomEndpointingRule.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::AssistantCustomEndpointingRule] + # @return [Vapi::StartSpeakingPlanCustomEndpointingRulesItem] + def self.assistant(member:) + new(member: member, discriminant: "assistant") + end + + # @param member [Vapi::CustomerCustomEndpointingRule] + # @return [Vapi::StartSpeakingPlanCustomEndpointingRulesItem] + def self.customer(member:) + new(member: member, discriminant: "customer") + end + + # @param member [Vapi::BothCustomEndpointingRule] + # @return [Vapi::StartSpeakingPlanCustomEndpointingRulesItem] + def self.both(member:) + new(member: member, discriminant: "both") + end + end +end diff --git a/lib/vapi_server_sdk/types/structured_data_plan.rb b/lib/vapi_server_sdk/types/structured_data_plan.rb index a3bae19..a43254f 100644 --- a/lib/vapi_server_sdk/types/structured_data_plan.rb +++ b/lib/vapi_server_sdk/types/structured_data_plan.rb @@ -7,11 +7,20 @@ module Vapi class StructuredDataPlan # @return [Array Object}>] These are the messages used to generate the structured data. - # @default: ` [ { "role": "system", "content": "You are an expert data extractor. - # You will be given a transcript of a call. Extract structured data per the JSON - # Schema. DO NOT return anything except the structured data.\n\nJson - # Schema:\\n{{schema}}\n\nOnly respond with the JSON." }, { "role": "user", - # "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert data extractor. You will be given a transcript + # of a call. Extract structured data per the JSON Schema. DO NOT return anything + # except the structured data.\n\nJson Schema:\\n{{schema}}\n\nOnly respond with + # the JSON." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: the transcript of the call from `call.artifact.transcript`- @@ -47,11 +56,20 @@ class StructuredDataPlan OMIT = Object.new # @param messages [Array Object}>] These are the messages used to generate the structured data. - # @default: ` [ { "role": "system", "content": "You are an expert data extractor. - # You will be given a transcript of a call. Extract structured data per the JSON - # Schema. DO NOT return anything except the structured data.\n\nJson - # Schema:\\n{{schema}}\n\nOnly respond with the JSON." }, { "role": "user", - # "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert data extractor. You will be given a transcript + # of a call. Extract structured data per the JSON Schema. DO NOT return anything + # except the structured data.\n\nJson Schema:\\n{{schema}}\n\nOnly respond with + # the JSON." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: the transcript of the call from `call.artifact.transcript`- diff --git a/lib/vapi_server_sdk/types/subscription.rb b/lib/vapi_server_sdk/types/subscription.rb new file mode 100644 index 0000000..e2a37c8 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription.rb @@ -0,0 +1,336 @@ +# frozen_string_literal: true + +require "date" +require_relative "subscription_type" +require_relative "subscription_status" +require_relative "auto_reload_plan" +require "ostruct" +require "json" + +module Vapi + class Subscription + # @return [String] This is the unique identifier for the subscription. + attr_reader :id + # @return [DateTime] This is the timestamp when the subscription was created. + attr_reader :created_at + # @return [DateTime] This is the timestamp when the subscription was last updated. + attr_reader :updated_at + # @return [Vapi::SubscriptionType] This is the type / tier of the subscription. + attr_reader :type + # @return [Vapi::SubscriptionStatus] This is the status of the subscription. Past due subscriptions are subscriptions + # with past due payments. + attr_reader :status + # @return [String] This is the number of credits the subscription currently has. + # Note: This is a string to avoid floating point precision issues. + attr_reader :credits + # @return [Float] This is the total concurrency limit for the subscription. + attr_reader :concurrency_limit + # @return [Float] This is the default concurrency limit for the subscription. + attr_reader :concurrency_limit_included + # @return [Float] This is the purchased add-on concurrency limit for the subscription. + attr_reader :concurrency_limit_purchased + # @return [Float] This is the ID of the monthly job that charges for subscription add ons and + # phone numbers. + attr_reader :monthly_charge_schedule_id + # @return [Float] This is the ID of the monthly job that checks whether the credit balance of the + # subscription + # is sufficient for the monthly charge. + attr_reader :monthly_credit_check_schedule_id + # @return [String] This is the Stripe customer ID. + attr_reader :stripe_customer_id + # @return [String] This is the Stripe payment ID. + attr_reader :stripe_payment_method_id + # @return [Boolean] If this flag is true, then the user has purchased slack support. + attr_reader :slack_support_enabled + # @return [String] If this subscription has a slack support subscription, the slack channel's ID + # will be stored here. + attr_reader :slack_channel_id + # @return [Boolean] This is the HIPAA enabled flag for the subscription. It determines whether orgs + # under this + # subscription have the option to enable HIPAA compliance. + attr_reader :hipaa_enabled + # @return [String] This is the ID for the Common Paper agreement outlining the HIPAA contract. + attr_reader :hipaa_common_paper_agreement_id + # @return [String] This is the Stripe fingerprint of the payment method (card). It allows us + # to detect users who try to abuse our system through multiple sign-ups. + attr_reader :stripe_payment_method_fingerprint + # @return [String] This is the stripe customer's email. + attr_reader :stripe_customer_email + # @return [String] This is the email of the referrer for the subscription. + attr_reader :referred_by_email + # @return [Vapi::AutoReloadPlan] This is the auto reload plan configured for the subscription. + attr_reader :auto_reload_plan + # @return [Float] The number of minutes included in the subscription. Enterprise only. + attr_reader :minutes_included + # @return [Float] The number of minutes used in the subscription. Enterprise only. + attr_reader :minutes_used + # @return [Float] The per minute charge on minutes that exceed the included minutes. Enterprise + # only. + attr_reader :minutes_overage_cost + # @return [Array] The list of providers included in the subscription. Enterprise only. + attr_reader :providers_included + # @return [Float] The maximum number of outbound calls this subscription may make in a day. Resets + # every night. + attr_reader :outbound_calls_daily_limit + # @return [Float] The current number of outbound calls the subscription has made in the current + # day. + attr_reader :outbound_calls_counter + # @return [DateTime] This is the timestamp at which the outbound calls counter is scheduled to reset + # at. + attr_reader :outbound_calls_counter_next_reset_at + # @return [Array] This is the IDs of the coupons applicable to this subscription. + attr_reader :coupon_ids + # @return [String] This is the number of credits left obtained from a coupon. + attr_reader :coupon_usage_left + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param id [String] This is the unique identifier for the subscription. + # @param created_at [DateTime] This is the timestamp when the subscription was created. + # @param updated_at [DateTime] This is the timestamp when the subscription was last updated. + # @param type [Vapi::SubscriptionType] This is the type / tier of the subscription. + # @param status [Vapi::SubscriptionStatus] This is the status of the subscription. Past due subscriptions are subscriptions + # with past due payments. + # @param credits [String] This is the number of credits the subscription currently has. + # Note: This is a string to avoid floating point precision issues. + # @param concurrency_limit [Float] This is the total concurrency limit for the subscription. + # @param concurrency_limit_included [Float] This is the default concurrency limit for the subscription. + # @param concurrency_limit_purchased [Float] This is the purchased add-on concurrency limit for the subscription. + # @param monthly_charge_schedule_id [Float] This is the ID of the monthly job that charges for subscription add ons and + # phone numbers. + # @param monthly_credit_check_schedule_id [Float] This is the ID of the monthly job that checks whether the credit balance of the + # subscription + # is sufficient for the monthly charge. + # @param stripe_customer_id [String] This is the Stripe customer ID. + # @param stripe_payment_method_id [String] This is the Stripe payment ID. + # @param slack_support_enabled [Boolean] If this flag is true, then the user has purchased slack support. + # @param slack_channel_id [String] If this subscription has a slack support subscription, the slack channel's ID + # will be stored here. + # @param hipaa_enabled [Boolean] This is the HIPAA enabled flag for the subscription. It determines whether orgs + # under this + # subscription have the option to enable HIPAA compliance. + # @param hipaa_common_paper_agreement_id [String] This is the ID for the Common Paper agreement outlining the HIPAA contract. + # @param stripe_payment_method_fingerprint [String] This is the Stripe fingerprint of the payment method (card). It allows us + # to detect users who try to abuse our system through multiple sign-ups. + # @param stripe_customer_email [String] This is the stripe customer's email. + # @param referred_by_email [String] This is the email of the referrer for the subscription. + # @param auto_reload_plan [Vapi::AutoReloadPlan] This is the auto reload plan configured for the subscription. + # @param minutes_included [Float] The number of minutes included in the subscription. Enterprise only. + # @param minutes_used [Float] The number of minutes used in the subscription. Enterprise only. + # @param minutes_overage_cost [Float] The per minute charge on minutes that exceed the included minutes. Enterprise + # only. + # @param providers_included [Array] The list of providers included in the subscription. Enterprise only. + # @param outbound_calls_daily_limit [Float] The maximum number of outbound calls this subscription may make in a day. Resets + # every night. + # @param outbound_calls_counter [Float] The current number of outbound calls the subscription has made in the current + # day. + # @param outbound_calls_counter_next_reset_at [DateTime] This is the timestamp at which the outbound calls counter is scheduled to reset + # at. + # @param coupon_ids [Array] This is the IDs of the coupons applicable to this subscription. + # @param coupon_usage_left [String] This is the number of credits left obtained from a coupon. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::Subscription] + def initialize(id:, created_at:, updated_at:, type:, status:, credits:, concurrency_limit:, + concurrency_limit_included:, concurrency_limit_purchased:, monthly_charge_schedule_id: OMIT, monthly_credit_check_schedule_id: OMIT, stripe_customer_id: OMIT, stripe_payment_method_id: OMIT, slack_support_enabled: OMIT, slack_channel_id: OMIT, hipaa_enabled: OMIT, hipaa_common_paper_agreement_id: OMIT, stripe_payment_method_fingerprint: OMIT, stripe_customer_email: OMIT, referred_by_email: OMIT, auto_reload_plan: OMIT, minutes_included: OMIT, minutes_used: OMIT, minutes_overage_cost: OMIT, providers_included: OMIT, outbound_calls_daily_limit: OMIT, outbound_calls_counter: OMIT, outbound_calls_counter_next_reset_at: OMIT, coupon_ids: OMIT, coupon_usage_left: OMIT, additional_properties: nil) + @id = id + @created_at = created_at + @updated_at = updated_at + @type = type + @status = status + @credits = credits + @concurrency_limit = concurrency_limit + @concurrency_limit_included = concurrency_limit_included + @concurrency_limit_purchased = concurrency_limit_purchased + @monthly_charge_schedule_id = monthly_charge_schedule_id if monthly_charge_schedule_id != OMIT + @monthly_credit_check_schedule_id = monthly_credit_check_schedule_id if monthly_credit_check_schedule_id != OMIT + @stripe_customer_id = stripe_customer_id if stripe_customer_id != OMIT + @stripe_payment_method_id = stripe_payment_method_id if stripe_payment_method_id != OMIT + @slack_support_enabled = slack_support_enabled if slack_support_enabled != OMIT + @slack_channel_id = slack_channel_id if slack_channel_id != OMIT + @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT + @hipaa_common_paper_agreement_id = hipaa_common_paper_agreement_id if hipaa_common_paper_agreement_id != OMIT + if stripe_payment_method_fingerprint != OMIT + @stripe_payment_method_fingerprint = stripe_payment_method_fingerprint + end + @stripe_customer_email = stripe_customer_email if stripe_customer_email != OMIT + @referred_by_email = referred_by_email if referred_by_email != OMIT + @auto_reload_plan = auto_reload_plan if auto_reload_plan != OMIT + @minutes_included = minutes_included if minutes_included != OMIT + @minutes_used = minutes_used if minutes_used != OMIT + @minutes_overage_cost = minutes_overage_cost if minutes_overage_cost != OMIT + @providers_included = providers_included if providers_included != OMIT + @outbound_calls_daily_limit = outbound_calls_daily_limit if outbound_calls_daily_limit != OMIT + @outbound_calls_counter = outbound_calls_counter if outbound_calls_counter != OMIT + if outbound_calls_counter_next_reset_at != OMIT + @outbound_calls_counter_next_reset_at = outbound_calls_counter_next_reset_at + end + @coupon_ids = coupon_ids if coupon_ids != OMIT + @coupon_usage_left = coupon_usage_left if coupon_usage_left != OMIT + @additional_properties = additional_properties + @_field_set = { + "id": id, + "createdAt": created_at, + "updatedAt": updated_at, + "type": type, + "status": status, + "credits": credits, + "concurrencyLimit": concurrency_limit, + "concurrencyLimitIncluded": concurrency_limit_included, + "concurrencyLimitPurchased": concurrency_limit_purchased, + "monthlyChargeScheduleId": monthly_charge_schedule_id, + "monthlyCreditCheckScheduleId": monthly_credit_check_schedule_id, + "stripeCustomerId": stripe_customer_id, + "stripePaymentMethodId": stripe_payment_method_id, + "slackSupportEnabled": slack_support_enabled, + "slackChannelId": slack_channel_id, + "hipaaEnabled": hipaa_enabled, + "hipaaCommonPaperAgreementId": hipaa_common_paper_agreement_id, + "stripePaymentMethodFingerprint": stripe_payment_method_fingerprint, + "stripeCustomerEmail": stripe_customer_email, + "referredByEmail": referred_by_email, + "autoReloadPlan": auto_reload_plan, + "minutesIncluded": minutes_included, + "minutesUsed": minutes_used, + "minutesOverageCost": minutes_overage_cost, + "providersIncluded": providers_included, + "outboundCallsDailyLimit": outbound_calls_daily_limit, + "outboundCallsCounter": outbound_calls_counter, + "outboundCallsCounterNextResetAt": outbound_calls_counter_next_reset_at, + "couponIds": coupon_ids, + "couponUsageLeft": coupon_usage_left + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of Subscription + # + # @param json_object [String] + # @return [Vapi::Subscription] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + id = parsed_json["id"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + type = parsed_json["type"] + status = parsed_json["status"] + credits = parsed_json["credits"] + concurrency_limit = parsed_json["concurrencyLimit"] + concurrency_limit_included = parsed_json["concurrencyLimitIncluded"] + concurrency_limit_purchased = parsed_json["concurrencyLimitPurchased"] + monthly_charge_schedule_id = parsed_json["monthlyChargeScheduleId"] + monthly_credit_check_schedule_id = parsed_json["monthlyCreditCheckScheduleId"] + stripe_customer_id = parsed_json["stripeCustomerId"] + stripe_payment_method_id = parsed_json["stripePaymentMethodId"] + slack_support_enabled = parsed_json["slackSupportEnabled"] + slack_channel_id = parsed_json["slackChannelId"] + hipaa_enabled = parsed_json["hipaaEnabled"] + hipaa_common_paper_agreement_id = parsed_json["hipaaCommonPaperAgreementId"] + stripe_payment_method_fingerprint = parsed_json["stripePaymentMethodFingerprint"] + stripe_customer_email = parsed_json["stripeCustomerEmail"] + referred_by_email = parsed_json["referredByEmail"] + if parsed_json["autoReloadPlan"].nil? + auto_reload_plan = nil + else + auto_reload_plan = parsed_json["autoReloadPlan"].to_json + auto_reload_plan = Vapi::AutoReloadPlan.from_json(json_object: auto_reload_plan) + end + minutes_included = parsed_json["minutesIncluded"] + minutes_used = parsed_json["minutesUsed"] + minutes_overage_cost = parsed_json["minutesOverageCost"] + providers_included = parsed_json["providersIncluded"] + outbound_calls_daily_limit = parsed_json["outboundCallsDailyLimit"] + outbound_calls_counter = parsed_json["outboundCallsCounter"] + outbound_calls_counter_next_reset_at = unless parsed_json["outboundCallsCounterNextResetAt"].nil? + DateTime.parse(parsed_json["outboundCallsCounterNextResetAt"]) + end + coupon_ids = parsed_json["couponIds"] + coupon_usage_left = parsed_json["couponUsageLeft"] + new( + id: id, + created_at: created_at, + updated_at: updated_at, + type: type, + status: status, + credits: credits, + concurrency_limit: concurrency_limit, + concurrency_limit_included: concurrency_limit_included, + concurrency_limit_purchased: concurrency_limit_purchased, + monthly_charge_schedule_id: monthly_charge_schedule_id, + monthly_credit_check_schedule_id: monthly_credit_check_schedule_id, + stripe_customer_id: stripe_customer_id, + stripe_payment_method_id: stripe_payment_method_id, + slack_support_enabled: slack_support_enabled, + slack_channel_id: slack_channel_id, + hipaa_enabled: hipaa_enabled, + hipaa_common_paper_agreement_id: hipaa_common_paper_agreement_id, + stripe_payment_method_fingerprint: stripe_payment_method_fingerprint, + stripe_customer_email: stripe_customer_email, + referred_by_email: referred_by_email, + auto_reload_plan: auto_reload_plan, + minutes_included: minutes_included, + minutes_used: minutes_used, + minutes_overage_cost: minutes_overage_cost, + providers_included: providers_included, + outbound_calls_daily_limit: outbound_calls_daily_limit, + outbound_calls_counter: outbound_calls_counter, + outbound_calls_counter_next_reset_at: outbound_calls_counter_next_reset_at, + coupon_ids: coupon_ids, + coupon_usage_left: coupon_usage_left, + additional_properties: struct + ) + end + + # Serialize an instance of Subscription to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.type.is_a?(Vapi::SubscriptionType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") + obj.status.is_a?(Vapi::SubscriptionStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") + obj.credits.is_a?(String) != false || raise("Passed value for field obj.credits is not the expected type, validation failed.") + obj.concurrency_limit.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") + obj.concurrency_limit_included.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit_included is not the expected type, validation failed.") + obj.concurrency_limit_purchased.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit_purchased is not the expected type, validation failed.") + obj.monthly_charge_schedule_id&.is_a?(Float) != false || raise("Passed value for field obj.monthly_charge_schedule_id is not the expected type, validation failed.") + obj.monthly_credit_check_schedule_id&.is_a?(Float) != false || raise("Passed value for field obj.monthly_credit_check_schedule_id is not the expected type, validation failed.") + obj.stripe_customer_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_customer_id is not the expected type, validation failed.") + obj.stripe_payment_method_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_method_id is not the expected type, validation failed.") + obj.slack_support_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.slack_support_enabled is not the expected type, validation failed.") + obj.slack_channel_id&.is_a?(String) != false || raise("Passed value for field obj.slack_channel_id is not the expected type, validation failed.") + obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") + obj.hipaa_common_paper_agreement_id&.is_a?(String) != false || raise("Passed value for field obj.hipaa_common_paper_agreement_id is not the expected type, validation failed.") + obj.stripe_payment_method_fingerprint&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_method_fingerprint is not the expected type, validation failed.") + obj.stripe_customer_email&.is_a?(String) != false || raise("Passed value for field obj.stripe_customer_email is not the expected type, validation failed.") + obj.referred_by_email&.is_a?(String) != false || raise("Passed value for field obj.referred_by_email is not the expected type, validation failed.") + obj.auto_reload_plan.nil? || Vapi::AutoReloadPlan.validate_raw(obj: obj.auto_reload_plan) + obj.minutes_included&.is_a?(Float) != false || raise("Passed value for field obj.minutes_included is not the expected type, validation failed.") + obj.minutes_used&.is_a?(Float) != false || raise("Passed value for field obj.minutes_used is not the expected type, validation failed.") + obj.minutes_overage_cost&.is_a?(Float) != false || raise("Passed value for field obj.minutes_overage_cost is not the expected type, validation failed.") + obj.providers_included&.is_a?(Array) != false || raise("Passed value for field obj.providers_included is not the expected type, validation failed.") + obj.outbound_calls_daily_limit&.is_a?(Float) != false || raise("Passed value for field obj.outbound_calls_daily_limit is not the expected type, validation failed.") + obj.outbound_calls_counter&.is_a?(Float) != false || raise("Passed value for field obj.outbound_calls_counter is not the expected type, validation failed.") + obj.outbound_calls_counter_next_reset_at&.is_a?(DateTime) != false || raise("Passed value for field obj.outbound_calls_counter_next_reset_at is not the expected type, validation failed.") + obj.coupon_ids&.is_a?(Array) != false || raise("Passed value for field obj.coupon_ids is not the expected type, validation failed.") + obj.coupon_usage_left&.is_a?(String) != false || raise("Passed value for field obj.coupon_usage_left is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb b/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb new file mode 100644 index 0000000..c95069c --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class SubscriptionConcurrencyLineBuyDto + # @return [Float] This is the number of concurrency lines to purchase. + attr_reader :quantity + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param quantity [Float] This is the number of concurrency lines to purchase. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SubscriptionConcurrencyLineBuyDto] + def initialize(quantity:, additional_properties: nil) + @quantity = quantity + @additional_properties = additional_properties + @_field_set = { "quantity": quantity } + end + + # Deserialize a JSON object to an instance of SubscriptionConcurrencyLineBuyDto + # + # @param json_object [String] + # @return [Vapi::SubscriptionConcurrencyLineBuyDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + quantity = parsed_json["quantity"] + new(quantity: quantity, additional_properties: struct) + end + + # Serialize an instance of SubscriptionConcurrencyLineBuyDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.quantity.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb b/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb new file mode 100644 index 0000000..2653ed8 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class SubscriptionConcurrencyLineRemoveDto + # @return [Float] This is the number of concurrency lines to remove. + attr_reader :quantity + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param quantity [Float] This is the number of concurrency lines to remove. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SubscriptionConcurrencyLineRemoveDto] + def initialize(quantity:, additional_properties: nil) + @quantity = quantity + @additional_properties = additional_properties + @_field_set = { "quantity": quantity } + end + + # Deserialize a JSON object to an instance of SubscriptionConcurrencyLineRemoveDto + # + # @param json_object [String] + # @return [Vapi::SubscriptionConcurrencyLineRemoveDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + quantity = parsed_json["quantity"] + new(quantity: quantity, additional_properties: struct) + end + + # Serialize an instance of SubscriptionConcurrencyLineRemoveDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.quantity.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb b/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb new file mode 100644 index 0000000..48c1b16 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class SubscriptionCouponAddDto + # @return [String] This is the ID of the org within the subscription which the coupon will take + # effect on. + attr_reader :org_id + # @return [String] This is the code of the coupon to apply to the subscription. + attr_reader :coupon_code + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param org_id [String] This is the ID of the org within the subscription which the coupon will take + # effect on. + # @param coupon_code [String] This is the code of the coupon to apply to the subscription. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SubscriptionCouponAddDto] + def initialize(org_id:, coupon_code:, additional_properties: nil) + @org_id = org_id + @coupon_code = coupon_code + @additional_properties = additional_properties + @_field_set = { "orgId": org_id, "couponCode": coupon_code } + end + + # Deserialize a JSON object to an instance of SubscriptionCouponAddDto + # + # @param json_object [String] + # @return [Vapi::SubscriptionCouponAddDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + org_id = parsed_json["orgId"] + coupon_code = parsed_json["couponCode"] + new( + org_id: org_id, + coupon_code: coupon_code, + additional_properties: struct + ) + end + + # Serialize an instance of SubscriptionCouponAddDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.coupon_code.is_a?(String) != false || raise("Passed value for field obj.coupon_code is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/subscription_monthly_charge.rb b/lib/vapi_server_sdk/types/subscription_monthly_charge.rb new file mode 100644 index 0000000..5cc3b38 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_monthly_charge.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class SubscriptionMonthlyCharge + # @return [Float] This is the monthly charge for the subscription. + attr_reader :monthly_charge + # @return [Array Object}>] These are the different costs that make up the monthly charge. + attr_reader :costs + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param monthly_charge [Float] This is the monthly charge for the subscription. + # @param costs [Array Object}>] These are the different costs that make up the monthly charge. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SubscriptionMonthlyCharge] + def initialize(monthly_charge:, costs:, additional_properties: nil) + @monthly_charge = monthly_charge + @costs = costs + @additional_properties = additional_properties + @_field_set = { "monthlyCharge": monthly_charge, "costs": costs } + end + + # Deserialize a JSON object to an instance of SubscriptionMonthlyCharge + # + # @param json_object [String] + # @return [Vapi::SubscriptionMonthlyCharge] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + monthly_charge = parsed_json["monthlyCharge"] + costs = parsed_json["costs"] + new( + monthly_charge: monthly_charge, + costs: costs, + additional_properties: struct + ) + end + + # Serialize an instance of SubscriptionMonthlyCharge to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.monthly_charge.is_a?(Float) != false || raise("Passed value for field obj.monthly_charge is not the expected type, validation failed.") + obj.costs.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/subscription_status.rb b/lib/vapi_server_sdk/types/subscription_status.rb new file mode 100644 index 0000000..2830a23 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the status of the subscription. Past due subscriptions are subscriptions + # with past due payments. + class SubscriptionStatus + ACTIVE = "active" + FROZEN = "frozen" + end +end diff --git a/lib/vapi_server_sdk/types/subscription_type.rb b/lib/vapi_server_sdk/types/subscription_type.rb new file mode 100644 index 0000000..58981c9 --- /dev/null +++ b/lib/vapi_server_sdk/types/subscription_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the type / tier of the subscription. + class SubscriptionType + TRIAL = "trial" + PAY_AS_YOU_GO = "pay-as-you-go" + ENTERPRISE = "enterprise" + end +end diff --git a/lib/vapi_server_sdk/types/success_evaluation_plan.rb b/lib/vapi_server_sdk/types/success_evaluation_plan.rb index d4929d9..b9a6e86 100644 --- a/lib/vapi_server_sdk/types/success_evaluation_plan.rb +++ b/lib/vapi_server_sdk/types/success_evaluation_plan.rb @@ -23,14 +23,25 @@ class SuccessEvaluationPlan # Default is 'PassFail'. attr_reader :rubric # @return [Array Object}>] These are the messages used to generate the success evaluation. - # @default: ` [ { "role": "system", "content": "You are an expert call evaluator. - # You will be given a transcript of a call and the system prompt of the AI - # participant. Determine if the call was successful based on the objectives - # inferred from the system prompt. DO NOT return anything except the - # result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with the result." }, { "role": - # "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" }, { "role": - # "user", "content": "Here was the system prompt of the - # call:\n\n{{systemPrompt}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert call evaluator. You will be given a transcript + # of a call and the system prompt of the AI participant. Determine if the call was + # successful based on the objectives inferred from the system prompt. DO NOT + # return anything except the result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with + # the result." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # }, + # { + # "role": "user", + # "content": "Here was the system prompt of the call:\n\n{{systemPrompt}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: the transcript of the call from `call.artifact.transcript`- @@ -75,14 +86,25 @@ class SuccessEvaluationPlan # - 'PassFail': A simple 'true' if call passed, 'false' if not. # Default is 'PassFail'. # @param messages [Array Object}>] These are the messages used to generate the success evaluation. - # @default: ` [ { "role": "system", "content": "You are an expert call evaluator. - # You will be given a transcript of a call and the system prompt of the AI - # participant. Determine if the call was successful based on the objectives - # inferred from the system prompt. DO NOT return anything except the - # result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with the result." }, { "role": - # "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" }, { "role": - # "user", "content": "Here was the system prompt of the - # call:\n\n{{systemPrompt}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert call evaluator. You will be given a transcript + # of a call and the system prompt of the AI participant. Determine if the call was + # successful based on the objectives inferred from the system prompt. DO NOT + # return anything except the result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with + # the result." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # }, + # { + # "role": "user", + # "content": "Here was the system prompt of the call:\n\n{{systemPrompt}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: the transcript of the call from `call.artifact.transcript`- diff --git a/lib/vapi_server_sdk/types/summary_plan.rb b/lib/vapi_server_sdk/types/summary_plan.rb index 2277f5b..b24102d 100644 --- a/lib/vapi_server_sdk/types/summary_plan.rb +++ b/lib/vapi_server_sdk/types/summary_plan.rb @@ -6,10 +6,19 @@ module Vapi class SummaryPlan # @return [Array Object}>] These are the messages used to generate the summary. - # @default: ` [ { "role": "system", "content": "You are an expert note-taker. You - # will be given a transcript of a call. Summarize the call in 2-3 sentences. DO - # NOT return anything except the summary." }, { "role": "user", "content": "Here - # is the transcript:\n\n{{transcript}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert note-taker. You will be given a transcript of + # a call. Summarize the call in 2-3 sentences. DO NOT return anything except the + # summary." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: The transcript of the call from `call.artifact.transcript`- @@ -38,10 +47,19 @@ class SummaryPlan OMIT = Object.new # @param messages [Array Object}>] These are the messages used to generate the summary. - # @default: ` [ { "role": "system", "content": "You are an expert note-taker. You - # will be given a transcript of a call. Summarize the call in 2-3 sentences. DO - # NOT return anything except the summary." }, { "role": "user", "content": "Here - # is the transcript:\n\n{{transcript}}\n\n" } ]` + # @default: ``` + # [ + # { + # "role": "system", + # "content": "You are an expert note-taker. You will be given a transcript of + # a call. Summarize the call in 2-3 sentences. DO NOT return anything except the + # summary." + # }, + # { + # "role": "user", + # "content": "Here is the transcript:\n\n{{transcript}}\n\n" + # } + # ]``` # You can customize by providing any messages you want. # Here are the template variables available: # - {{transcript}}: The transcript of the call from `call.artifact.transcript`- diff --git a/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb b/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb index 7681ef7..8ccc9c2 100644 --- a/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +++ b/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb @@ -12,5 +12,6 @@ class SyncVoiceLibraryDtoProvidersItem OPENAI = "openai" PLAYHT = "playht" RIME_AI = "rime-ai" + TAVUS = "tavus" end end diff --git a/lib/vapi_server_sdk/types/tavus_conversation_properties.rb b/lib/vapi_server_sdk/types/tavus_conversation_properties.rb new file mode 100644 index 0000000..4108e43 --- /dev/null +++ b/lib/vapi_server_sdk/types/tavus_conversation_properties.rb @@ -0,0 +1,173 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class TavusConversationProperties + # @return [Float] The maximum duration of the call in seconds. The default `maxCallDuration` is + # 3600 seconds (1 hour). + # Once the time limit specified by this parameter has been reached, the + # conversation will automatically shut down. + attr_reader :max_call_duration + # @return [Float] The duration in seconds after which the call will be automatically shut down + # once the last participant leaves. + attr_reader :participant_left_timeout + # @return [Float] Starting from conversation creation, the duration in seconds after which the + # call will be automatically shut down if no participant joins the call. + # Default is 300 seconds (5 minutes). + attr_reader :participant_absent_timeout + # @return [Boolean] If true, the user will be able to record the conversation. + attr_reader :enable_recording + # @return [Boolean] If true, the user will be able to transcribe the conversation. + # You can find more instructions on displaying transcriptions if you are using + # your custom DailyJS components here. + # You need to have an event listener on Daily that listens for `app-messages`. + attr_reader :enable_transcription + # @return [Boolean] If true, the background will be replaced with a greenscreen (RGB values: `[0, + # 255, 155]`). + # You can use WebGL on the frontend to make the greenscreen transparent or change + # its color. + attr_reader :apply_greenscreen + # @return [String] The language of the conversation. Please provide the **full language name**, not + # the two-letter code. + # If you are using your own TTS voice, please ensure it supports the language you + # provide. + # If you are using a stock replica or default persona, please note that only + # ElevenLabs and Cartesia supported languages are available. + # You can find a full list of supported languages for Cartesia here, for + # ElevenLabs here, and for PlayHT here. + attr_reader :language + # @return [String] The name of the S3 bucket where the recording will be stored. + attr_reader :recording_s_3_bucket_name + # @return [String] The region of the S3 bucket where the recording will be stored. + attr_reader :recording_s_3_bucket_region + # @return [String] The ARN of the role that will be assumed to access the S3 bucket. + attr_reader :aws_assume_role_arn + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param max_call_duration [Float] The maximum duration of the call in seconds. The default `maxCallDuration` is + # 3600 seconds (1 hour). + # Once the time limit specified by this parameter has been reached, the + # conversation will automatically shut down. + # @param participant_left_timeout [Float] The duration in seconds after which the call will be automatically shut down + # once the last participant leaves. + # @param participant_absent_timeout [Float] Starting from conversation creation, the duration in seconds after which the + # call will be automatically shut down if no participant joins the call. + # Default is 300 seconds (5 minutes). + # @param enable_recording [Boolean] If true, the user will be able to record the conversation. + # @param enable_transcription [Boolean] If true, the user will be able to transcribe the conversation. + # You can find more instructions on displaying transcriptions if you are using + # your custom DailyJS components here. + # You need to have an event listener on Daily that listens for `app-messages`. + # @param apply_greenscreen [Boolean] If true, the background will be replaced with a greenscreen (RGB values: `[0, + # 255, 155]`). + # You can use WebGL on the frontend to make the greenscreen transparent or change + # its color. + # @param language [String] The language of the conversation. Please provide the **full language name**, not + # the two-letter code. + # If you are using your own TTS voice, please ensure it supports the language you + # provide. + # If you are using a stock replica or default persona, please note that only + # ElevenLabs and Cartesia supported languages are available. + # You can find a full list of supported languages for Cartesia here, for + # ElevenLabs here, and for PlayHT here. + # @param recording_s_3_bucket_name [String] The name of the S3 bucket where the recording will be stored. + # @param recording_s_3_bucket_region [String] The region of the S3 bucket where the recording will be stored. + # @param aws_assume_role_arn [String] The ARN of the role that will be assumed to access the S3 bucket. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TavusConversationProperties] + def initialize(max_call_duration: OMIT, participant_left_timeout: OMIT, participant_absent_timeout: OMIT, + enable_recording: OMIT, enable_transcription: OMIT, apply_greenscreen: OMIT, language: OMIT, recording_s_3_bucket_name: OMIT, recording_s_3_bucket_region: OMIT, aws_assume_role_arn: OMIT, additional_properties: nil) + @max_call_duration = max_call_duration if max_call_duration != OMIT + @participant_left_timeout = participant_left_timeout if participant_left_timeout != OMIT + @participant_absent_timeout = participant_absent_timeout if participant_absent_timeout != OMIT + @enable_recording = enable_recording if enable_recording != OMIT + @enable_transcription = enable_transcription if enable_transcription != OMIT + @apply_greenscreen = apply_greenscreen if apply_greenscreen != OMIT + @language = language if language != OMIT + @recording_s_3_bucket_name = recording_s_3_bucket_name if recording_s_3_bucket_name != OMIT + @recording_s_3_bucket_region = recording_s_3_bucket_region if recording_s_3_bucket_region != OMIT + @aws_assume_role_arn = aws_assume_role_arn if aws_assume_role_arn != OMIT + @additional_properties = additional_properties + @_field_set = { + "maxCallDuration": max_call_duration, + "participantLeftTimeout": participant_left_timeout, + "participantAbsentTimeout": participant_absent_timeout, + "enableRecording": enable_recording, + "enableTranscription": enable_transcription, + "applyGreenscreen": apply_greenscreen, + "language": language, + "recordingS3BucketName": recording_s_3_bucket_name, + "recordingS3BucketRegion": recording_s_3_bucket_region, + "awsAssumeRoleArn": aws_assume_role_arn + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TavusConversationProperties + # + # @param json_object [String] + # @return [Vapi::TavusConversationProperties] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + max_call_duration = parsed_json["maxCallDuration"] + participant_left_timeout = parsed_json["participantLeftTimeout"] + participant_absent_timeout = parsed_json["participantAbsentTimeout"] + enable_recording = parsed_json["enableRecording"] + enable_transcription = parsed_json["enableTranscription"] + apply_greenscreen = parsed_json["applyGreenscreen"] + language = parsed_json["language"] + recording_s_3_bucket_name = parsed_json["recordingS3BucketName"] + recording_s_3_bucket_region = parsed_json["recordingS3BucketRegion"] + aws_assume_role_arn = parsed_json["awsAssumeRoleArn"] + new( + max_call_duration: max_call_duration, + participant_left_timeout: participant_left_timeout, + participant_absent_timeout: participant_absent_timeout, + enable_recording: enable_recording, + enable_transcription: enable_transcription, + apply_greenscreen: apply_greenscreen, + language: language, + recording_s_3_bucket_name: recording_s_3_bucket_name, + recording_s_3_bucket_region: recording_s_3_bucket_region, + aws_assume_role_arn: aws_assume_role_arn, + additional_properties: struct + ) + end + + # Serialize an instance of TavusConversationProperties to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.max_call_duration&.is_a?(Float) != false || raise("Passed value for field obj.max_call_duration is not the expected type, validation failed.") + obj.participant_left_timeout&.is_a?(Float) != false || raise("Passed value for field obj.participant_left_timeout is not the expected type, validation failed.") + obj.participant_absent_timeout&.is_a?(Float) != false || raise("Passed value for field obj.participant_absent_timeout is not the expected type, validation failed.") + obj.enable_recording&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_recording is not the expected type, validation failed.") + obj.enable_transcription&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_transcription is not the expected type, validation failed.") + obj.apply_greenscreen&.is_a?(Boolean) != false || raise("Passed value for field obj.apply_greenscreen is not the expected type, validation failed.") + obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + obj.recording_s_3_bucket_name&.is_a?(String) != false || raise("Passed value for field obj.recording_s_3_bucket_name is not the expected type, validation failed.") + obj.recording_s_3_bucket_region&.is_a?(String) != false || raise("Passed value for field obj.recording_s_3_bucket_region is not the expected type, validation failed.") + obj.aws_assume_role_arn&.is_a?(String) != false || raise("Passed value for field obj.aws_assume_role_arn is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/tavus_credential.rb b/lib/vapi_server_sdk/types/tavus_credential.rb new file mode 100644 index 0000000..9ee559e --- /dev/null +++ b/lib/vapi_server_sdk/types/tavus_credential.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class TavusCredential + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TavusCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TavusCredential + # + # @param json_object [String] + # @return [Vapi::TavusCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of TavusCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/tavus_voice.rb b/lib/vapi_server_sdk/types/tavus_voice.rb new file mode 100644 index 0000000..08a3e2b --- /dev/null +++ b/lib/vapi_server_sdk/types/tavus_voice.rb @@ -0,0 +1,163 @@ +# frozen_string_literal: true + +require_relative "tavus_voice_voice_id" +require_relative "chunk_plan" +require_relative "tavus_conversation_properties" +require_relative "fallback_plan" +require "ostruct" +require "json" + +module Vapi + class TavusVoice + # @return [Vapi::TavusVoiceVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [String] This is the unique identifier for the persona that the replica will use in the + # conversation. + attr_reader :persona_id + # @return [String] This is the url that will receive webhooks with updates regarding the + # conversation state. + attr_reader :callback_url + # @return [String] This is the name for the conversation. + attr_reader :conversation_name + # @return [String] This is the context that will be appended to any context provided in the + # persona, if one is provided. + attr_reader :conversational_context + # @return [String] This is the custom greeting that the replica will give once a participant joines + # the conversation. + attr_reader :custom_greeting + # @return [Vapi::TavusConversationProperties] These are optional properties used to customize the conversation. + attr_reader :properties + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::TavusVoiceVoiceId] This is the provider-specific ID that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param persona_id [String] This is the unique identifier for the persona that the replica will use in the + # conversation. + # @param callback_url [String] This is the url that will receive webhooks with updates regarding the + # conversation state. + # @param conversation_name [String] This is the name for the conversation. + # @param conversational_context [String] This is the context that will be appended to any context provided in the + # persona, if one is provided. + # @param custom_greeting [String] This is the custom greeting that the replica will give once a participant joines + # the conversation. + # @param properties [Vapi::TavusConversationProperties] These are optional properties used to customize the conversation. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TavusVoice] + def initialize(voice_id:, chunk_plan: OMIT, persona_id: OMIT, callback_url: OMIT, conversation_name: OMIT, + conversational_context: OMIT, custom_greeting: OMIT, properties: OMIT, fallback_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @chunk_plan = chunk_plan if chunk_plan != OMIT + @persona_id = persona_id if persona_id != OMIT + @callback_url = callback_url if callback_url != OMIT + @conversation_name = conversation_name if conversation_name != OMIT + @conversational_context = conversational_context if conversational_context != OMIT + @custom_greeting = custom_greeting if custom_greeting != OMIT + @properties = properties if properties != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "chunkPlan": chunk_plan, + "personaId": persona_id, + "callbackUrl": callback_url, + "conversationName": conversation_name, + "conversationalContext": conversational_context, + "customGreeting": custom_greeting, + "properties": properties, + "fallbackPlan": fallback_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TavusVoice + # + # @param json_object [String] + # @return [Vapi::TavusVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::TavusVoiceVoiceId.from_json(json_object: voice_id) + end + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + persona_id = parsed_json["personaId"] + callback_url = parsed_json["callbackUrl"] + conversation_name = parsed_json["conversationName"] + conversational_context = parsed_json["conversationalContext"] + custom_greeting = parsed_json["customGreeting"] + if parsed_json["properties"].nil? + properties = nil + else + properties = parsed_json["properties"].to_json + properties = Vapi::TavusConversationProperties.from_json(json_object: properties) + end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end + new( + voice_id: voice_id, + chunk_plan: chunk_plan, + persona_id: persona_id, + callback_url: callback_url, + conversation_name: conversation_name, + conversational_context: conversational_context, + custom_greeting: custom_greeting, + properties: properties, + fallback_plan: fallback_plan, + additional_properties: struct + ) + end + + # Serialize an instance of TavusVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::TavusVoiceVoiceId.validate_raw(obj: obj.voice_id) + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.persona_id&.is_a?(String) != false || raise("Passed value for field obj.persona_id is not the expected type, validation failed.") + obj.callback_url&.is_a?(String) != false || raise("Passed value for field obj.callback_url is not the expected type, validation failed.") + obj.conversation_name&.is_a?(String) != false || raise("Passed value for field obj.conversation_name is not the expected type, validation failed.") + obj.conversational_context&.is_a?(String) != false || raise("Passed value for field obj.conversational_context is not the expected type, validation failed.") + obj.custom_greeting&.is_a?(String) != false || raise("Passed value for field obj.custom_greeting is not the expected type, validation failed.") + obj.properties.nil? || Vapi::TavusConversationProperties.validate_raw(obj: obj.properties) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/tavus_voice_voice_id.rb b/lib/vapi_server_sdk/types/tavus_voice_voice_id.rb new file mode 100644 index 0000000..1178293 --- /dev/null +++ b/lib/vapi_server_sdk/types/tavus_voice_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class TavusVoiceVoiceId + # Deserialize a JSON object to an instance of TavusVoiceVoiceId + # + # @param json_object [String] + # @return [Vapi::TavusVoiceVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/text_content.rb b/lib/vapi_server_sdk/types/text_content.rb new file mode 100644 index 0000000..8f97077 --- /dev/null +++ b/lib/vapi_server_sdk/types/text_content.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +require_relative "text_content_language" +require "ostruct" +require "json" + +module Vapi + class TextContent + # @return [String] + attr_reader :type + # @return [String] + attr_reader :text + # @return [Vapi::TextContentLanguage] + attr_reader :language + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param type [String] + # @param text [String] + # @param language [Vapi::TextContentLanguage] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TextContent] + def initialize(type:, text:, language:, additional_properties: nil) + @type = type + @text = text + @language = language + @additional_properties = additional_properties + @_field_set = { "type": type, "text": text, "language": language } + end + + # Deserialize a JSON object to an instance of TextContent + # + # @param json_object [String] + # @return [Vapi::TextContent] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + type = parsed_json["type"] + text = parsed_json["text"] + language = parsed_json["language"] + new( + type: type, + text: text, + language: language, + additional_properties: struct + ) + end + + # Serialize an instance of TextContent to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") + obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") + obj.language.is_a?(Vapi::TextContentLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/text_content_language.rb b/lib/vapi_server_sdk/types/text_content_language.rb new file mode 100644 index 0000000..d906888 --- /dev/null +++ b/lib/vapi_server_sdk/types/text_content_language.rb @@ -0,0 +1,191 @@ +# frozen_string_literal: true + +module Vapi + class TextContentLanguage + AA = "aa" + AB = "ab" + AE = "ae" + AF = "af" + AK = "ak" + AM = "am" + AN = "an" + AR = "ar" + AS = "as" + AV = "av" + AY = "ay" + AZ = "az" + BA = "ba" + BE = "be" + BG = "bg" + BH = "bh" + BI = "bi" + BM = "bm" + BN = "bn" + BO = "bo" + BR = "br" + BS = "bs" + CA = "ca" + CE = "ce" + CH = "ch" + CO = "co" + CR = "cr" + CS = "cs" + CU = "cu" + CV = "cv" + CY = "cy" + DA = "da" + DE = "de" + DV = "dv" + DZ = "dz" + EE = "ee" + EL = "el" + EN = "en" + EO = "eo" + ES = "es" + ET = "et" + EU = "eu" + FA = "fa" + FF = "ff" + FI = "fi" + FJ = "fj" + FO = "fo" + FR = "fr" + FY = "fy" + GA = "ga" + GD = "gd" + GL = "gl" + GN = "gn" + GU = "gu" + GV = "gv" + HA = "ha" + HE = "he" + HI = "hi" + HO = "ho" + HR = "hr" + HT = "ht" + HU = "hu" + HY = "hy" + HZ = "hz" + IA = "ia" + ID = "id" + IE = "ie" + IG = "ig" + II = "ii" + IK = "ik" + IO = "io" + IS = "is" + IT = "it" + IU = "iu" + JA = "ja" + JV = "jv" + KA = "ka" + KG = "kg" + KI = "ki" + KJ = "kj" + KK = "kk" + KL = "kl" + KM = "km" + KN = "kn" + KO = "ko" + KR = "kr" + KS = "ks" + KU = "ku" + KV = "kv" + KW = "kw" + KY = "ky" + LA = "la" + LB = "lb" + LG = "lg" + LI = "li" + LN = "ln" + LO = "lo" + LT = "lt" + LU = "lu" + LV = "lv" + MG = "mg" + MH = "mh" + MI = "mi" + MK = "mk" + ML = "ml" + MN = "mn" + MR = "mr" + MS = "ms" + MT = "mt" + MY = "my" + NA = "na" + NB = "nb" + ND = "nd" + NE = "ne" + NG = "ng" + NL = "nl" + NN = "nn" + NO = "no" + NR = "nr" + NV = "nv" + NY = "ny" + OC = "oc" + OJ = "oj" + OM = "om" + OR = "or" + OS = "os" + PA = "pa" + PI = "pi" + PL = "pl" + PS = "ps" + PT = "pt" + QU = "qu" + RM = "rm" + RN = "rn" + RO = "ro" + RU = "ru" + RW = "rw" + SA = "sa" + SC = "sc" + SD = "sd" + SE = "se" + SG = "sg" + SI = "si" + SK = "sk" + SL = "sl" + SM = "sm" + SN = "sn" + SO = "so" + SQ = "sq" + SR = "sr" + SS = "ss" + ST = "st" + SU = "su" + SV = "sv" + SW = "sw" + TA = "ta" + TE = "te" + TG = "tg" + TH = "th" + TI = "ti" + TK = "tk" + TL = "tl" + TN = "tn" + TO = "to" + TR = "tr" + TS = "ts" + TT = "tt" + TW = "tw" + TY = "ty" + UG = "ug" + UK = "uk" + UR = "ur" + UZ = "uz" + VE = "ve" + VI = "vi" + VO = "vo" + WA = "wa" + WO = "wo" + XH = "xh" + YI = "yi" + YUE = "yue" + YO = "yo" + ZA = "za" + ZH = "zh" + ZU = "zu" + end +end diff --git a/lib/vapi_server_sdk/types/text_editor_tool.rb b/lib/vapi_server_sdk/types/text_editor_tool.rb new file mode 100644 index 0000000..fce74bc --- /dev/null +++ b/lib/vapi_server_sdk/types/text_editor_tool.rb @@ -0,0 +1,194 @@ +# frozen_string_literal: true + +require_relative "text_editor_tool_messages_item" +require "date" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class TextEditorTool + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [String] This is the unique identifier for the tool. + attr_reader :id + # @return [String] This is the unique identifier for the organization that this tool belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + attr_reader :updated_at + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'str_replace_editor' + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param id [String] This is the unique identifier for the tool. + # @param org_id [String] This is the unique identifier for the organization that this tool belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the tool was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the tool was last updated. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'str_replace_editor' + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TextEditorTool] + def initialize(sub_type:, id:, org_id:, created_at:, updated_at:, name:, async: OMIT, messages: OMIT, function: OMIT, + server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @function = function if function != OMIT + @server = server if server != OMIT + @name = name + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "function": function, + "server": server, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TextEditorTool + # + # @param json_object [String] + # @return [Vapi::TextEditorTool] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::TextEditorToolMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + new( + async: async, + messages: messages, + sub_type: sub_type, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + function: function, + server: server, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of TextEditorTool to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/text_editor_tool_messages_item.rb b/lib/vapi_server_sdk/types/text_editor_tool_messages_item.rb new file mode 100644 index 0000000..f4d4b74 --- /dev/null +++ b/lib/vapi_server_sdk/types/text_editor_tool_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class TextEditorToolMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::TextEditorToolMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of TextEditorToolMessagesItem + # + # @param json_object [String] + # @return [Vapi::TextEditorToolMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::TextEditorToolMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::TextEditorToolMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::TextEditorToolMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::TextEditorToolMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/together_ai_credential.rb b/lib/vapi_server_sdk/types/together_ai_credential.rb index 208dba6..9b9ed53 100644 --- a/lib/vapi_server_sdk/types/together_ai_credential.rb +++ b/lib/vapi_server_sdk/types/together_ai_credential.rb @@ -18,6 +18,8 @@ class TogetherAiCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -32,15 +34,17 @@ class TogetherAiCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TogetherAiCredential] - def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, additional_properties: nil) + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, addi "id": id, "orgId": org_id, "createdAt": created_at, - "updatedAt": updated_at - } + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of TogetherAiCredential @@ -65,6 +72,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] new( provider: provider, api_key: api_key, @@ -72,6 +80,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/together_ai_model.rb b/lib/vapi_server_sdk/types/together_ai_model.rb index 8f567d1..d2f6308 100644 --- a/lib/vapi_server_sdk/types/together_ai_model.rb +++ b/lib/vapi_server_sdk/types/together_ai_model.rb @@ -2,7 +2,7 @@ require_relative "open_ai_message" require_relative "together_ai_model_tools_item" -require_relative "knowledge_base" +require_relative "create_custom_knowledge_base_dto" require "ostruct" require "json" @@ -18,13 +18,15 @@ class TogetherAiModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b attr_reader :model # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -55,10 +57,11 @@ class TogetherAiModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -73,14 +76,15 @@ class TogetherAiModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TogetherAiModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: OMIT, knowledge_base: OMIT, - max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -89,9 +93,10 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, temperature: "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -116,14 +121,15 @@ def self.from_json(json_object:) Vapi::TogetherAiModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] - model = parsed_json["model"] - temperature = parsed_json["temperature"] if parsed_json["knowledgeBase"].nil? knowledge_base = nil else knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -131,9 +137,10 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -158,9 +165,10 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/tool_message_complete.rb b/lib/vapi_server_sdk/types/tool_message_complete.rb index 2fb5ee0..a9e3a52 100644 --- a/lib/vapi_server_sdk/types/tool_message_complete.rb +++ b/lib/vapi_server_sdk/types/tool_message_complete.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "tool_message_complete_role" require_relative "condition" require "ostruct" @@ -7,6 +8,15 @@ module Vapi class ToolMessageComplete + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [Vapi::ToolMessageCompleteRole] This is optional and defaults to "assistant". # When role=assistant, `content` is said out loud. # When role=system, `content` is passed to the model in a system message. Example: @@ -42,6 +52,14 @@ class ToolMessageComplete OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param role [Vapi::ToolMessageCompleteRole] This is optional and defaults to "assistant". # When role=assistant, `content` is said out loud. # When role=system, `content` is passed to the model in a system message. Example: @@ -67,14 +85,16 @@ class ToolMessageComplete # in order for this message to be triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ToolMessageComplete] - def initialize(content:, role: OMIT, end_call_after_spoken_enabled: OMIT, conditions: OMIT, + def initialize(contents: OMIT, role: OMIT, end_call_after_spoken_enabled: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil) + @contents = contents if contents != OMIT @role = role if role != OMIT @end_call_after_spoken_enabled = end_call_after_spoken_enabled if end_call_after_spoken_enabled != OMIT - @content = content + @content = content if content != OMIT @conditions = conditions if conditions != OMIT @additional_properties = additional_properties @_field_set = { + "contents": contents, "role": role, "endCallAfterSpokenEnabled": end_call_after_spoken_enabled, "content": content, @@ -91,6 +111,10 @@ def initialize(content:, role: OMIT, end_call_after_spoken_enabled: OMIT, condit def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end role = parsed_json["role"] end_call_after_spoken_enabled = parsed_json["endCallAfterSpokenEnabled"] content = parsed_json["content"] @@ -99,6 +123,7 @@ def self.from_json(json_object:) Vapi::Condition.from_json(json_object: item) end new( + contents: contents, role: role, end_call_after_spoken_enabled: end_call_after_spoken_enabled, content: content, @@ -121,9 +146,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.role&.is_a?(Vapi::ToolMessageCompleteRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.") obj.end_call_after_spoken_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.end_call_after_spoken_enabled is not the expected type, validation failed.") - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/tool_message_delayed.rb b/lib/vapi_server_sdk/types/tool_message_delayed.rb index 95f6260..b60f9bf 100644 --- a/lib/vapi_server_sdk/types/tool_message_delayed.rb +++ b/lib/vapi_server_sdk/types/tool_message_delayed.rb @@ -1,11 +1,21 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "condition" require "ostruct" require "json" module Vapi class ToolMessageDelayed + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [Float] The number of milliseconds to wait for the server response before saying this # message. attr_reader :timing_milliseconds @@ -22,6 +32,14 @@ class ToolMessageDelayed OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param timing_milliseconds [Float] The number of milliseconds to wait for the server response before saying this # message. # @param content [String] This is the content that the assistant says when this message is triggered. @@ -29,12 +47,15 @@ class ToolMessageDelayed # in order for this message to be triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ToolMessageDelayed] - def initialize(content:, timing_milliseconds: OMIT, conditions: OMIT, additional_properties: nil) + def initialize(contents: OMIT, timing_milliseconds: OMIT, content: OMIT, conditions: OMIT, + additional_properties: nil) + @contents = contents if contents != OMIT @timing_milliseconds = timing_milliseconds if timing_milliseconds != OMIT - @content = content + @content = content if content != OMIT @conditions = conditions if conditions != OMIT @additional_properties = additional_properties @_field_set = { + "contents": contents, "timingMilliseconds": timing_milliseconds, "content": content, "conditions": conditions @@ -50,6 +71,10 @@ def initialize(content:, timing_milliseconds: OMIT, conditions: OMIT, additional def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end timing_milliseconds = parsed_json["timingMilliseconds"] content = parsed_json["content"] conditions = parsed_json["conditions"]&.map do |item| @@ -57,6 +82,7 @@ def self.from_json(json_object:) Vapi::Condition.from_json(json_object: item) end new( + contents: contents, timing_milliseconds: timing_milliseconds, content: content, conditions: conditions, @@ -78,8 +104,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.timing_milliseconds&.is_a?(Float) != false || raise("Passed value for field obj.timing_milliseconds is not the expected type, validation failed.") - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/tool_message_failed.rb b/lib/vapi_server_sdk/types/tool_message_failed.rb index 46a6ff2..2488310 100644 --- a/lib/vapi_server_sdk/types/tool_message_failed.rb +++ b/lib/vapi_server_sdk/types/tool_message_failed.rb @@ -1,11 +1,21 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "condition" require "ostruct" require "json" module Vapi class ToolMessageFailed + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [Boolean] This is an optional boolean that if true, the call will end after the message is # spoken. Default is false. # @default false @@ -23,6 +33,14 @@ class ToolMessageFailed OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param end_call_after_spoken_enabled [Boolean] This is an optional boolean that if true, the call will end after the message is # spoken. Default is false. # @default false @@ -31,12 +49,15 @@ class ToolMessageFailed # in order for this message to be triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ToolMessageFailed] - def initialize(content:, end_call_after_spoken_enabled: OMIT, conditions: OMIT, additional_properties: nil) + def initialize(contents: OMIT, end_call_after_spoken_enabled: OMIT, content: OMIT, conditions: OMIT, + additional_properties: nil) + @contents = contents if contents != OMIT @end_call_after_spoken_enabled = end_call_after_spoken_enabled if end_call_after_spoken_enabled != OMIT - @content = content + @content = content if content != OMIT @conditions = conditions if conditions != OMIT @additional_properties = additional_properties @_field_set = { + "contents": contents, "endCallAfterSpokenEnabled": end_call_after_spoken_enabled, "content": content, "conditions": conditions @@ -52,6 +73,10 @@ def initialize(content:, end_call_after_spoken_enabled: OMIT, conditions: OMIT, def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end end_call_after_spoken_enabled = parsed_json["endCallAfterSpokenEnabled"] content = parsed_json["content"] conditions = parsed_json["conditions"]&.map do |item| @@ -59,6 +84,7 @@ def self.from_json(json_object:) Vapi::Condition.from_json(json_object: item) end new( + contents: contents, end_call_after_spoken_enabled: end_call_after_spoken_enabled, content: content, conditions: conditions, @@ -80,8 +106,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.end_call_after_spoken_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.end_call_after_spoken_enabled is not the expected type, validation failed.") - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/tool_message_start.rb b/lib/vapi_server_sdk/types/tool_message_start.rb index 83a0ebc..a290899 100644 --- a/lib/vapi_server_sdk/types/tool_message_start.rb +++ b/lib/vapi_server_sdk/types/tool_message_start.rb @@ -1,11 +1,21 @@ # frozen_string_literal: true +require_relative "text_content" require_relative "condition" require "ostruct" require "json" module Vapi class ToolMessageStart + # @return [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. + attr_reader :contents # @return [String] This is the content that the assistant says when this message is triggered. attr_reader :content # @return [Array] This is an optional array of conditions that the tool call arguments must meet @@ -19,16 +29,25 @@ class ToolMessageStart OMIT = Object.new + # @param contents [Array] This is an alternative to the `content` property. It allows to specify variants + # of the same content, one per language. + # Usage: + # - If your assistants are multilingual, you can provide content for each + # language. + # - If you don't provide content for a language, the first item in the array will + # be automatically translated to the active language at that moment. + # This will override the `content` property. # @param content [String] This is the content that the assistant says when this message is triggered. # @param conditions [Array] This is an optional array of conditions that the tool call arguments must meet # in order for this message to be triggered. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ToolMessageStart] - def initialize(content:, conditions: OMIT, additional_properties: nil) - @content = content + def initialize(contents: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil) + @contents = contents if contents != OMIT + @content = content if content != OMIT @conditions = conditions if conditions != OMIT @additional_properties = additional_properties - @_field_set = { "content": content, "conditions": conditions }.reject do |_k, v| + @_field_set = { "contents": contents, "content": content, "conditions": conditions }.reject do |_k, v| v == OMIT end end @@ -40,12 +59,17 @@ def initialize(content:, conditions: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + contents = parsed_json["contents"]&.map do |item| + item = item.to_json + Vapi::TextContent.from_json(json_object: item) + end content = parsed_json["content"] conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::Condition.from_json(json_object: item) end new( + contents: contents, content: content, conditions: conditions, additional_properties: struct @@ -66,7 +90,8 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") + obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") + obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/transfer_destination_assistant.rb b/lib/vapi_server_sdk/types/transfer_destination_assistant.rb index 009d536..c1051ec 100644 --- a/lib/vapi_server_sdk/types/transfer_destination_assistant.rb +++ b/lib/vapi_server_sdk/types/transfer_destination_assistant.rb @@ -1,12 +1,26 @@ # frozen_string_literal: true +require_relative "transfer_destination_assistant_message" require_relative "transfer_mode" require "ostruct" require "json" module Vapi class TransferDestinationAssistant - # @return [Vapi::TransferMode] This is the mode to use for the transfer. Default is `rolling-history`. + # @return [Vapi::TransferDestinationAssistantMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + attr_reader :message + # @return [Vapi::TransferMode] This is the mode to use for the transfer. Defaults to `rolling-history`. # - `rolling-history`: This is the default mode. It keeps the entire conversation # history and appends the new assistant's system message on transfer. # Example: @@ -25,8 +39,8 @@ class TransferDestinationAssistant # user: i need help with my account # assistant: (destination.message) # system: assistant2 system message - # assistant: assistant2 first message (or model generated if firstMessageMode is - # set to `assistant-speaks-first-with-model-generated-message`) + # assistant: assistant2 first message (or model generated if firstMessageMode + # is set to `assistant-speaks-first-with-model-generated-message`) # - `swap-system-message-in-history`: This replaces the original system message # with the new assistant's system message on transfer. # Example: @@ -44,20 +58,27 @@ class TransferDestinationAssistant # assistant: how can i help? # user: i need help with my account # assistant: (destination.message) - # assistant: assistant2 first message (or model generated if firstMessageMode is - # set to `assistant-speaks-first-with-model-generated-message`) + # assistant: assistant2 first message (or model generated if firstMessageMode + # is set to `assistant-speaks-first-with-model-generated-message`) + # - `delete-history`: This deletes the entire conversation history on transfer. + # Example: + # Pre-transfer: + # system: assistant1 system message + # assistant: assistant1 first message + # user: hey, good morning + # assistant: how can i help? + # user: i need help with my account + # assistant: (destination.message) + # Post-transfer: + # system: assistant2 system message + # assistant: assistant2 first message + # user: Yes, please + # assistant: how can i help? + # user: i need help with my account + # @default 'rolling-history' attr_reader :transfer_mode # @return [String] This is the assistant to transfer the call to. attr_reader :assistant_name - # @return [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is - # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently - # transfer. This is especially useful when transferring between assistants in a - # squad. In this scenario, you likely also want to set - # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` - # for the destination assistant. - attr_reader :message # @return [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. attr_reader :description @@ -69,7 +90,19 @@ class TransferDestinationAssistant OMIT = Object.new - # @param transfer_mode [Vapi::TransferMode] This is the mode to use for the transfer. Default is `rolling-history`. + # @param message [Vapi::TransferDestinationAssistantMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + # @param transfer_mode [Vapi::TransferMode] This is the mode to use for the transfer. Defaults to `rolling-history`. # - `rolling-history`: This is the default mode. It keeps the entire conversation # history and appends the new assistant's system message on transfer. # Example: @@ -88,8 +121,8 @@ class TransferDestinationAssistant # user: i need help with my account # assistant: (destination.message) # system: assistant2 system message - # assistant: assistant2 first message (or model generated if firstMessageMode is - # set to `assistant-speaks-first-with-model-generated-message`) + # assistant: assistant2 first message (or model generated if firstMessageMode + # is set to `assistant-speaks-first-with-model-generated-message`) # - `swap-system-message-in-history`: This replaces the original system message # with the new assistant's system message on transfer. # Example: @@ -107,31 +140,39 @@ class TransferDestinationAssistant # assistant: how can i help? # user: i need help with my account # assistant: (destination.message) - # assistant: assistant2 first message (or model generated if firstMessageMode is - # set to `assistant-speaks-first-with-model-generated-message`) + # assistant: assistant2 first message (or model generated if firstMessageMode + # is set to `assistant-speaks-first-with-model-generated-message`) + # - `delete-history`: This deletes the entire conversation history on transfer. + # Example: + # Pre-transfer: + # system: assistant1 system message + # assistant: assistant1 first message + # user: hey, good morning + # assistant: how can i help? + # user: i need help with my account + # assistant: (destination.message) + # Post-transfer: + # system: assistant2 system message + # assistant: assistant2 first message + # user: Yes, please + # assistant: how can i help? + # user: i need help with my account + # @default 'rolling-history' # @param assistant_name [String] This is the assistant to transfer the call to. - # @param message [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is - # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently - # transfer. This is especially useful when transferring between assistants in a - # squad. In this scenario, you likely also want to set - # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` - # for the destination assistant. # @param description [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransferDestinationAssistant] - def initialize(assistant_name:, transfer_mode: OMIT, message: OMIT, description: OMIT, additional_properties: nil) + def initialize(assistant_name:, message: OMIT, transfer_mode: OMIT, description: OMIT, additional_properties: nil) + @message = message if message != OMIT @transfer_mode = transfer_mode if transfer_mode != OMIT @assistant_name = assistant_name - @message = message if message != OMIT @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { + "message": message, "transferMode": transfer_mode, "assistantName": assistant_name, - "message": message, "description": description }.reject do |_k, v| v == OMIT @@ -145,14 +186,19 @@ def initialize(assistant_name:, transfer_mode: OMIT, message: OMIT, description: def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::TransferDestinationAssistantMessage.from_json(json_object: message) + end transfer_mode = parsed_json["transferMode"] assistant_name = parsed_json["assistantName"] - message = parsed_json["message"] description = parsed_json["description"] new( + message: message, transfer_mode: transfer_mode, assistant_name: assistant_name, - message: message, description: description, additional_properties: struct ) @@ -172,9 +218,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.message.nil? || Vapi::TransferDestinationAssistantMessage.validate_raw(obj: obj.message) obj.transfer_mode&.is_a?(Vapi::TransferMode) != false || raise("Passed value for field obj.transfer_mode is not the expected type, validation failed.") obj.assistant_name.is_a?(String) != false || raise("Passed value for field obj.assistant_name is not the expected type, validation failed.") - obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/transfer_destination_assistant_message.rb b/lib/vapi_server_sdk/types/transfer_destination_assistant_message.rb new file mode 100644 index 0000000..746f762 --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_destination_assistant_message.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "json" +require_relative "custom_message" + +module Vapi + # This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + class TransferDestinationAssistantMessage + # Deserialize a JSON object to an instance of TransferDestinationAssistantMessage + # + # @param json_object [String] + # @return [Vapi::TransferDestinationAssistantMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::CustomMessage.validate_raw(obj: struct) + return Vapi::CustomMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return Vapi::CustomMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_destination_number.rb b/lib/vapi_server_sdk/types/transfer_destination_number.rb index 82ee4f4..3fdc953 100644 --- a/lib/vapi_server_sdk/types/transfer_destination_number.rb +++ b/lib/vapi_server_sdk/types/transfer_destination_number.rb @@ -1,10 +1,25 @@ # frozen_string_literal: true +require_relative "transfer_destination_number_message" +require_relative "transfer_plan" require "ostruct" require "json" module Vapi class TransferDestinationNumber + # @return [Vapi::TransferDestinationNumberMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + attr_reader :message # @return [Boolean] This is the flag to toggle the E164 check for the `number` field. This is an # advanced property which should be used if you know your use case requires it. # Use cases: @@ -35,15 +50,10 @@ class TransferDestinationNumber # For Twilio, you can read up more here: # https://www.twilio.com/docs/voice/twiml/dial#callerid attr_reader :caller_id - # @return [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is - # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently - # transfer. This is especially useful when transferring between assistants in a - # squad. In this scenario, you likely also want to set - # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` - # for the destination assistant. - attr_reader :message + # @return [Vapi::TransferPlan] This configures how transfer is executed and the experience of the destination + # party receiving the call. Defaults to `blind-transfer`. + # @default `transferPlan.mode='blind-transfer'` + attr_reader :transfer_plan # @return [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. attr_reader :description @@ -55,6 +65,18 @@ class TransferDestinationNumber OMIT = Object.new + # @param message [Vapi::TransferDestinationNumberMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. # @param number_e_164_check_enabled [Boolean] This is the flag to toggle the E164 check for the `number` field. This is an # advanced property which should be used if you know your use case requires it. # Use cases: @@ -81,33 +103,30 @@ class TransferDestinationNumber # to be a number that is owned or verified by your Transport provider like Twilio. # For Twilio, you can read up more here: # https://www.twilio.com/docs/voice/twiml/dial#callerid - # @param message [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is - # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently - # transfer. This is especially useful when transferring between assistants in a - # squad. In this scenario, you likely also want to set - # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` - # for the destination assistant. + # @param transfer_plan [Vapi::TransferPlan] This configures how transfer is executed and the experience of the destination + # party receiving the call. Defaults to `blind-transfer`. + # @default `transferPlan.mode='blind-transfer'` # @param description [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransferDestinationNumber] - def initialize(number:, number_e_164_check_enabled: OMIT, extension: OMIT, caller_id: OMIT, message: OMIT, - description: OMIT, additional_properties: nil) + def initialize(number:, message: OMIT, number_e_164_check_enabled: OMIT, extension: OMIT, caller_id: OMIT, + transfer_plan: OMIT, description: OMIT, additional_properties: nil) + @message = message if message != OMIT @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT @number = number @extension = extension if extension != OMIT @caller_id = caller_id if caller_id != OMIT - @message = message if message != OMIT + @transfer_plan = transfer_plan if transfer_plan != OMIT @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { + "message": message, "numberE164CheckEnabled": number_e_164_check_enabled, "number": number, "extension": extension, "callerId": caller_id, - "message": message, + "transferPlan": transfer_plan, "description": description }.reject do |_k, v| v == OMIT @@ -121,18 +140,30 @@ def initialize(number:, number_e_164_check_enabled: OMIT, extension: OMIT, calle def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::TransferDestinationNumberMessage.from_json(json_object: message) + end number_e_164_check_enabled = parsed_json["numberE164CheckEnabled"] number = parsed_json["number"] extension = parsed_json["extension"] caller_id = parsed_json["callerId"] - message = parsed_json["message"] + if parsed_json["transferPlan"].nil? + transfer_plan = nil + else + transfer_plan = parsed_json["transferPlan"].to_json + transfer_plan = Vapi::TransferPlan.from_json(json_object: transfer_plan) + end description = parsed_json["description"] new( + message: message, number_e_164_check_enabled: number_e_164_check_enabled, number: number, extension: extension, caller_id: caller_id, - message: message, + transfer_plan: transfer_plan, description: description, additional_properties: struct ) @@ -152,11 +183,12 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.message.nil? || Vapi::TransferDestinationNumberMessage.validate_raw(obj: obj.message) obj.number_e_164_check_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.number_e_164_check_enabled is not the expected type, validation failed.") obj.number.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.extension&.is_a?(String) != false || raise("Passed value for field obj.extension is not the expected type, validation failed.") obj.caller_id&.is_a?(String) != false || raise("Passed value for field obj.caller_id is not the expected type, validation failed.") - obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") + obj.transfer_plan.nil? || Vapi::TransferPlan.validate_raw(obj: obj.transfer_plan) obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/transfer_destination_number_message.rb b/lib/vapi_server_sdk/types/transfer_destination_number_message.rb new file mode 100644 index 0000000..398d40b --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_destination_number_message.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "json" +require_relative "custom_message" + +module Vapi + # This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + class TransferDestinationNumberMessage + # Deserialize a JSON object to an instance of TransferDestinationNumberMessage + # + # @param json_object [String] + # @return [Vapi::TransferDestinationNumberMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::CustomMessage.validate_raw(obj: struct) + return Vapi::CustomMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return Vapi::CustomMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_destination_sip.rb b/lib/vapi_server_sdk/types/transfer_destination_sip.rb index 359f68b..6f60c61 100644 --- a/lib/vapi_server_sdk/types/transfer_destination_sip.rb +++ b/lib/vapi_server_sdk/types/transfer_destination_sip.rb @@ -1,21 +1,33 @@ # frozen_string_literal: true +require_relative "transfer_destination_sip_message" +require_relative "transfer_plan" require "ostruct" require "json" module Vapi class TransferDestinationSip - # @return [String] This is the SIP URI to transfer the call to. - attr_reader :sip_uri - # @return [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is + # @return [Vapi::TransferDestinationSipMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently + # - If set to "", nothing is spoken. This is useful when you want to silently # transfer. This is especially useful when transferring between assistants in a # squad. In this scenario, you likely also want to set # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. attr_reader :message + # @return [String] This is the SIP URI to transfer the call to. + attr_reader :sip_uri + # @return [Vapi::TransferPlan] This configures how transfer is executed and the experience of the destination + # party receiving the call. Defaults to `blind-transfer`. + # @default `transferPlan.mode='blind-transfer'` + attr_reader :transfer_plan + # @return [Hash{String => Object}] These are custom headers to be added to SIP refer during transfer call. + attr_reader :sip_headers # @return [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. attr_reader :description @@ -27,25 +39,42 @@ class TransferDestinationSip OMIT = Object.new - # @param sip_uri [String] This is the SIP URI to transfer the call to. - # @param message [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is + # @param message [Vapi::TransferDestinationSipMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently + # - If set to "", nothing is spoken. This is useful when you want to silently # transfer. This is especially useful when transferring between assistants in a # squad. In this scenario, you likely also want to set # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + # @param sip_uri [String] This is the SIP URI to transfer the call to. + # @param transfer_plan [Vapi::TransferPlan] This configures how transfer is executed and the experience of the destination + # party receiving the call. Defaults to `blind-transfer`. + # @default `transferPlan.mode='blind-transfer'` + # @param sip_headers [Hash{String => Object}] These are custom headers to be added to SIP refer during transfer call. # @param description [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransferDestinationSip] - def initialize(sip_uri:, message: OMIT, description: OMIT, additional_properties: nil) - @sip_uri = sip_uri + def initialize(sip_uri:, message: OMIT, transfer_plan: OMIT, sip_headers: OMIT, description: OMIT, + additional_properties: nil) @message = message if message != OMIT + @sip_uri = sip_uri + @transfer_plan = transfer_plan if transfer_plan != OMIT + @sip_headers = sip_headers if sip_headers != OMIT @description = description if description != OMIT @additional_properties = additional_properties - @_field_set = { "sipUri": sip_uri, "message": message, "description": description }.reject do |_k, v| + @_field_set = { + "message": message, + "sipUri": sip_uri, + "transferPlan": transfer_plan, + "sipHeaders": sip_headers, + "description": description + }.reject do |_k, v| v == OMIT end end @@ -57,12 +86,26 @@ def initialize(sip_uri:, message: OMIT, description: OMIT, additional_properties def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::TransferDestinationSipMessage.from_json(json_object: message) + end sip_uri = parsed_json["sipUri"] - message = parsed_json["message"] + if parsed_json["transferPlan"].nil? + transfer_plan = nil + else + transfer_plan = parsed_json["transferPlan"].to_json + transfer_plan = Vapi::TransferPlan.from_json(json_object: transfer_plan) + end + sip_headers = parsed_json["sipHeaders"] description = parsed_json["description"] new( - sip_uri: sip_uri, message: message, + sip_uri: sip_uri, + transfer_plan: transfer_plan, + sip_headers: sip_headers, description: description, additional_properties: struct ) @@ -82,8 +125,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.message.nil? || Vapi::TransferDestinationSipMessage.validate_raw(obj: obj.message) obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") - obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") + obj.transfer_plan.nil? || Vapi::TransferPlan.validate_raw(obj: obj.transfer_plan) + obj.sip_headers&.is_a?(Hash) != false || raise("Passed value for field obj.sip_headers is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/transfer_destination_sip_message.rb b/lib/vapi_server_sdk/types/transfer_destination_sip_message.rb new file mode 100644 index 0000000..943c722 --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_destination_sip_message.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "json" +require_relative "custom_message" + +module Vapi + # This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + class TransferDestinationSipMessage + # Deserialize a JSON object to an instance of TransferDestinationSipMessage + # + # @param json_object [String] + # @return [Vapi::TransferDestinationSipMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::CustomMessage.validate_raw(obj: struct) + return Vapi::CustomMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return Vapi::CustomMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_destination_step.rb b/lib/vapi_server_sdk/types/transfer_destination_step.rb index 7bccbe2..dcfb872 100644 --- a/lib/vapi_server_sdk/types/transfer_destination_step.rb +++ b/lib/vapi_server_sdk/types/transfer_destination_step.rb @@ -1,21 +1,26 @@ # frozen_string_literal: true +require_relative "transfer_destination_step_message" require "ostruct" require "json" module Vapi class TransferDestinationStep - # @return [String] This is the step to transfer to. - attr_reader :step_name - # @return [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is + # @return [Vapi::TransferDestinationStepMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently + # - If set to "", nothing is spoken. This is useful when you want to silently # transfer. This is especially useful when transferring between assistants in a # squad. In this scenario, you likely also want to set # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. attr_reader :message + # @return [String] This is the step to transfer to. + attr_reader :step_name # @return [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. attr_reader :description @@ -27,25 +32,29 @@ class TransferDestinationStep OMIT = Object.new - # @param step_name [String] This is the step to transfer to. - # @param message [String] This is the message to say before transferring the call to the destination. - # If this is not provided and transfer tool messages is not provided, default is + # @param message [Vapi::TransferDestinationStepMessage] This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is # "Transferring the call now". - # If set to "", nothing is spoken. This is useful when you want to silently + # - If set to "", nothing is spoken. This is useful when you want to silently # transfer. This is especially useful when transferring between assistants in a # squad. In this scenario, you likely also want to set # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + # @param step_name [String] This is the step to transfer to. # @param description [String] This is the description of the destination, used by the AI to choose when and # how to transfer the call. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransferDestinationStep] def initialize(step_name:, message: OMIT, description: OMIT, additional_properties: nil) - @step_name = step_name @message = message if message != OMIT + @step_name = step_name @description = description if description != OMIT @additional_properties = additional_properties - @_field_set = { "stepName": step_name, "message": message, "description": description }.reject do |_k, v| + @_field_set = { "message": message, "stepName": step_name, "description": description }.reject do |_k, v| v == OMIT end end @@ -57,12 +66,17 @@ def initialize(step_name:, message: OMIT, description: OMIT, additional_properti def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::TransferDestinationStepMessage.from_json(json_object: message) + end step_name = parsed_json["stepName"] - message = parsed_json["message"] description = parsed_json["description"] new( - step_name: step_name, message: message, + step_name: step_name, description: description, additional_properties: struct ) @@ -82,8 +96,8 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.message.nil? || Vapi::TransferDestinationStepMessage.validate_raw(obj: obj.message) obj.step_name.is_a?(String) != false || raise("Passed value for field obj.step_name is not the expected type, validation failed.") - obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/transfer_destination_step_message.rb b/lib/vapi_server_sdk/types/transfer_destination_step_message.rb new file mode 100644 index 0000000..2d249b7 --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_destination_step_message.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require "json" +require_relative "custom_message" + +module Vapi + # This is spoken to the customer before connecting them to the destination. + # Usage: + # - If this is not provided and transfer tool messages is not provided, default is + # "Transferring the call now". + # - If set to "", nothing is spoken. This is useful when you want to silently + # transfer. This is especially useful when transferring between assistants in a + # squad. In this scenario, you likely also want to set + # `assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` + # for the destination assistant. + # This accepts a string or a ToolMessageStart class. Latter is useful if you want + # to specify multiple messages for different languages through the `contents` + # field. + class TransferDestinationStepMessage + # Deserialize a JSON object to an instance of TransferDestinationStepMessage + # + # @param json_object [String] + # @return [Vapi::TransferDestinationStepMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::CustomMessage.validate_raw(obj: struct) + return Vapi::CustomMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return Vapi::CustomMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_plan.rb b/lib/vapi_server_sdk/types/transfer_plan.rb new file mode 100644 index 0000000..f8d90bd --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_plan.rb @@ -0,0 +1,141 @@ +# frozen_string_literal: true + +require_relative "transfer_plan_mode" +require_relative "transfer_plan_message" +require_relative "summary_plan" +require "ostruct" +require "json" + +module Vapi + class TransferPlan + # @return [Vapi::TransferPlanMode] This configures how transfer is executed and the experience of the destination + # party receiving the call. + # Usage: + # - `blind-transfer`: The assistant forwards the call to the destination without + # any message or summary. + # - `blind-transfer-add-summary-to-sip-header`: The assistant forwards the call to + # the destination and adds a SIP header X-Transfer-Summary to the call to include + # the summary. + # - `warm-transfer-say-message`: The assistant dials the destination, delivers the + # `message` to the destination party, connects the customer, and leaves the call. + # - `warm-transfer-say-summary`: The assistant dials the destination, provides a + # summary of the call to the destination party, connects the customer, and leaves + # the call. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`: The + # assistant dials the destination, waits for the operator to speak, delivers the + # `message` to the destination party, and then connects the customer. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The + # assistant dials the destination, waits for the operator to speak, provides a + # summary of the call to the destination party, and then connects the customer. + # @default 'blind-transfer' + attr_reader :mode + # @return [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before + # connecting the customer. + # Usage: + # - Used only when `mode` is `warm-transfer-say-message` or + # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. + attr_reader :message + # @return [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the + # destination party. + # Usage: + # - Used only when `mode` is `warm-transfer-say-summary` or + # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`. + attr_reader :summary_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param mode [Vapi::TransferPlanMode] This configures how transfer is executed and the experience of the destination + # party receiving the call. + # Usage: + # - `blind-transfer`: The assistant forwards the call to the destination without + # any message or summary. + # - `blind-transfer-add-summary-to-sip-header`: The assistant forwards the call to + # the destination and adds a SIP header X-Transfer-Summary to the call to include + # the summary. + # - `warm-transfer-say-message`: The assistant dials the destination, delivers the + # `message` to the destination party, connects the customer, and leaves the call. + # - `warm-transfer-say-summary`: The assistant dials the destination, provides a + # summary of the call to the destination party, connects the customer, and leaves + # the call. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`: The + # assistant dials the destination, waits for the operator to speak, delivers the + # `message` to the destination party, and then connects the customer. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The + # assistant dials the destination, waits for the operator to speak, provides a + # summary of the call to the destination party, and then connects the customer. + # @default 'blind-transfer' + # @param message [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before + # connecting the customer. + # Usage: + # - Used only when `mode` is `warm-transfer-say-message` or + # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. + # @param summary_plan [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the + # destination party. + # Usage: + # - Used only when `mode` is `warm-transfer-say-summary` or + # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TransferPlan] + def initialize(mode:, message: OMIT, summary_plan: OMIT, additional_properties: nil) + @mode = mode + @message = message if message != OMIT + @summary_plan = summary_plan if summary_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "mode": mode, "message": message, "summaryPlan": summary_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TransferPlan + # + # @param json_object [String] + # @return [Vapi::TransferPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + mode = parsed_json["mode"] + if parsed_json["message"].nil? + message = nil + else + message = parsed_json["message"].to_json + message = Vapi::TransferPlanMessage.from_json(json_object: message) + end + if parsed_json["summaryPlan"].nil? + summary_plan = nil + else + summary_plan = parsed_json["summaryPlan"].to_json + summary_plan = Vapi::SummaryPlan.from_json(json_object: summary_plan) + end + new( + mode: mode, + message: message, + summary_plan: summary_plan, + additional_properties: struct + ) + end + + # Serialize an instance of TransferPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.mode.is_a?(Vapi::TransferPlanMode) != false || raise("Passed value for field obj.mode is not the expected type, validation failed.") + obj.message.nil? || Vapi::TransferPlanMessage.validate_raw(obj: obj.message) + obj.summary_plan.nil? || Vapi::SummaryPlan.validate_raw(obj: obj.summary_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_plan_message.rb b/lib/vapi_server_sdk/types/transfer_plan_message.rb new file mode 100644 index 0000000..e7b3e0d --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_plan_message.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require "json" +require_relative "custom_message" + +module Vapi + # This is the message the assistant will deliver to the destination party before + # connecting the customer. + # Usage: + # - Used only when `mode` is `warm-transfer-say-message` or + # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. + class TransferPlanMessage + # Deserialize a JSON object to an instance of TransferPlanMessage + # + # @param json_object [String] + # @return [Vapi::TransferPlanMessage] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + Vapi::CustomMessage.validate_raw(obj: struct) + return Vapi::CustomMessage.from_json(json_object: struct) unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return Vapi::CustomMessage.validate_raw(obj: obj) + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transfer_plan_mode.rb b/lib/vapi_server_sdk/types/transfer_plan_mode.rb new file mode 100644 index 0000000..55da9dc --- /dev/null +++ b/lib/vapi_server_sdk/types/transfer_plan_mode.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Vapi + # This configures how transfer is executed and the experience of the destination + # party receiving the call. + # Usage: + # - `blind-transfer`: The assistant forwards the call to the destination without + # any message or summary. + # - `blind-transfer-add-summary-to-sip-header`: The assistant forwards the call to + # the destination and adds a SIP header X-Transfer-Summary to the call to include + # the summary. + # - `warm-transfer-say-message`: The assistant dials the destination, delivers the + # `message` to the destination party, connects the customer, and leaves the call. + # - `warm-transfer-say-summary`: The assistant dials the destination, provides a + # summary of the call to the destination party, connects the customer, and leaves + # the call. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`: The + # assistant dials the destination, waits for the operator to speak, delivers the + # `message` to the destination party, and then connects the customer. + # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The + # assistant dials the destination, waits for the operator to speak, provides a + # summary of the call to the destination party, and then connects the customer. + # @default 'blind-transfer' + class TransferPlanMode + BLIND_TRANSFER = "blind-transfer" + BLIND_TRANSFER_ADD_SUMMARY_TO_SIP_HEADER = "blind-transfer-add-summary-to-sip-header" + WARM_TRANSFER_SAY_MESSAGE = "warm-transfer-say-message" + WARM_TRANSFER_SAY_SUMMARY = "warm-transfer-say-summary" + WARM_TRANSFER_WAIT_FOR_OPERATOR_TO_SPEAK_FIRST_AND_THEN_SAY_MESSAGE = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message" + WARM_TRANSFER_WAIT_FOR_OPERATOR_TO_SPEAK_FIRST_AND_THEN_SAY_SUMMARY = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary" + end +end diff --git a/lib/vapi_server_sdk/types/transport.rb b/lib/vapi_server_sdk/types/transport.rb new file mode 100644 index 0000000..5fdb754 --- /dev/null +++ b/lib/vapi_server_sdk/types/transport.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +require_relative "transport_provider" +require "ostruct" +require "json" + +module Vapi + class Transport + # @return [Vapi::TransportProvider] This is the provider used for the call. + attr_reader :provider + # @return [Boolean] This is determines whether the assistant will have video enabled. + # Only relevant for `webCall` type. + attr_reader :assistant_video_enabled + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [Vapi::TransportProvider] This is the provider used for the call. + # @param assistant_video_enabled [Boolean] This is determines whether the assistant will have video enabled. + # Only relevant for `webCall` type. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::Transport] + def initialize(provider: OMIT, assistant_video_enabled: OMIT, additional_properties: nil) + @provider = provider if provider != OMIT + @assistant_video_enabled = assistant_video_enabled if assistant_video_enabled != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "assistantVideoEnabled": assistant_video_enabled }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of Transport + # + # @param json_object [String] + # @return [Vapi::Transport] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + assistant_video_enabled = parsed_json["assistantVideoEnabled"] + new( + provider: provider, + assistant_video_enabled: assistant_video_enabled, + additional_properties: struct + ) + end + + # Serialize an instance of Transport to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider&.is_a?(Vapi::TransportProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.assistant_video_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.assistant_video_enabled is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/transport_cost.rb b/lib/vapi_server_sdk/types/transport_cost.rb index ac9240f..a3f8571 100644 --- a/lib/vapi_server_sdk/types/transport_cost.rb +++ b/lib/vapi_server_sdk/types/transport_cost.rb @@ -1,10 +1,13 @@ # frozen_string_literal: true +require_relative "transport_cost_provider" require "ostruct" require "json" module Vapi class TransportCost + # @return [Vapi::TransportCostProvider] + attr_reader :provider # @return [Float] This is the minutes of `transport` usage. This should match `call.endedAt` - # `call.startedAt`. attr_reader :minutes @@ -18,16 +21,20 @@ class TransportCost OMIT = Object.new + # @param provider [Vapi::TransportCostProvider] # @param minutes [Float] This is the minutes of `transport` usage. This should match `call.endedAt` - # `call.startedAt`. # @param cost [Float] This is the cost of the component in USD. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransportCost] - def initialize(minutes:, cost:, additional_properties: nil) + def initialize(minutes:, cost:, provider: OMIT, additional_properties: nil) + @provider = provider if provider != OMIT @minutes = minutes @cost = cost @additional_properties = additional_properties - @_field_set = { "minutes": minutes, "cost": cost } + @_field_set = { "provider": provider, "minutes": minutes, "cost": cost }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of TransportCost @@ -37,9 +44,11 @@ def initialize(minutes:, cost:, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] minutes = parsed_json["minutes"] cost = parsed_json["cost"] new( + provider: provider, minutes: minutes, cost: cost, additional_properties: struct @@ -60,6 +69,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.provider&.is_a?(Vapi::TransportCostProvider) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.minutes.is_a?(Float) != false || raise("Passed value for field obj.minutes is not the expected type, validation failed.") obj.cost.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/transport_cost_provider.rb b/lib/vapi_server_sdk/types/transport_cost_provider.rb new file mode 100644 index 0000000..108c560 --- /dev/null +++ b/lib/vapi_server_sdk/types/transport_cost_provider.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + class TransportCostProvider + TWILIO = "twilio" + VONAGE = "vonage" + VAPI = "vapi" + end +end diff --git a/lib/vapi_server_sdk/types/transport_provider.rb b/lib/vapi_server_sdk/types/transport_provider.rb new file mode 100644 index 0000000..201dec9 --- /dev/null +++ b/lib/vapi_server_sdk/types/transport_provider.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Vapi + # This is the provider used for the call. + class TransportProvider + TWILIO = "twilio" + VONAGE = "vonage" + VAPI = "vapi" + DAILY = "daily" + end +end diff --git a/lib/vapi_server_sdk/types/trieve_knowledge_base.rb b/lib/vapi_server_sdk/types/trieve_knowledge_base.rb new file mode 100644 index 0000000..5fed8b5 --- /dev/null +++ b/lib/vapi_server_sdk/types/trieve_knowledge_base.rb @@ -0,0 +1,125 @@ +# frozen_string_literal: true + +require_relative "trieve_knowledge_base_vector_store_search_plan" +require_relative "trieve_knowledge_base_vector_store_create_plan" +require "ostruct" +require "json" + +module Vapi + class TrieveKnowledgeBase + # @return [String] This is the name of the knowledge base. + attr_reader :name + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + attr_reader :vector_store_search_plan + # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + attr_reader :vector_store_create_plan + # @return [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + attr_reader :vector_store_provider_id + # @return [String] This is the id of the knowledge base. + attr_reader :id + # @return [String] This is the org id of the knowledge base. + attr_reader :org_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param name [String] This is the name of the knowledge base. + # @param vector_store_search_plan [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + # @param vector_store_create_plan [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + # @param vector_store_provider_id [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + # @param id [String] This is the id of the knowledge base. + # @param org_id [String] This is the org id of the knowledge base. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TrieveKnowledgeBase] + def initialize(vector_store_search_plan:, id:, org_id:, name: OMIT, vector_store_create_plan: OMIT, + vector_store_provider_id: OMIT, additional_properties: nil) + @name = name if name != OMIT + @vector_store_search_plan = vector_store_search_plan + @vector_store_create_plan = vector_store_create_plan if vector_store_create_plan != OMIT + @vector_store_provider_id = vector_store_provider_id if vector_store_provider_id != OMIT + @id = id + @org_id = org_id + @additional_properties = additional_properties + @_field_set = { + "name": name, + "vectorStoreSearchPlan": vector_store_search_plan, + "vectorStoreCreatePlan": vector_store_create_plan, + "vectorStoreProviderId": vector_store_provider_id, + "id": id, + "orgId": org_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of TrieveKnowledgeBase + # + # @param json_object [String] + # @return [Vapi::TrieveKnowledgeBase] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + name = parsed_json["name"] + if parsed_json["vectorStoreSearchPlan"].nil? + vector_store_search_plan = nil + else + vector_store_search_plan = parsed_json["vectorStoreSearchPlan"].to_json + vector_store_search_plan = Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.from_json(json_object: vector_store_search_plan) + end + if parsed_json["vectorStoreCreatePlan"].nil? + vector_store_create_plan = nil + else + vector_store_create_plan = parsed_json["vectorStoreCreatePlan"].to_json + vector_store_create_plan = Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.from_json(json_object: vector_store_create_plan) + end + vector_store_provider_id = parsed_json["vectorStoreProviderId"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + new( + name: name, + vector_store_search_plan: vector_store_search_plan, + vector_store_create_plan: vector_store_create_plan, + vector_store_provider_id: vector_store_provider_id, + id: id, + org_id: org_id, + additional_properties: struct + ) + end + + # Serialize an instance of TrieveKnowledgeBase to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.validate_raw(obj: obj.vector_store_search_plan) + obj.vector_store_create_plan.nil? || Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.validate_raw(obj: obj.vector_store_create_plan) + obj.vector_store_provider_id&.is_a?(String) != false || raise("Passed value for field obj.vector_store_provider_id is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_create_plan.rb b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_create_plan.rb new file mode 100644 index 0000000..5fcfe72 --- /dev/null +++ b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_create_plan.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class TrieveKnowledgeBaseVectorStoreCreatePlan + # @return [Array] These are the file ids that will be used to create the vector store. To upload + # files, use the `POST /files` endpoint. + attr_reader :file_ids + # @return [Float] This is an optional field which allows you to specify the number of splits you + # want per chunk. If not specified, the default 20 is used. However, you may want + # to use a different number. + attr_reader :target_splits_per_chunk + # @return [Array] This is an optional field which allows you to specify the delimiters to use when + # splitting the file before chunking the text. If not specified, the default + # [.!?\n] are used to split into sentences. However, you may want to use spaces or + # other delimiters. + attr_reader :split_delimiters + # @return [Boolean] This is an optional field which allows you to specify whether or not to + # rebalance the chunks created from the file. If not specified, the default true + # is used. If true, Trieve will evenly distribute remainder splits across chunks + # such that 66 splits with a target_splits_per_chunk of 20 will result in 3 chunks + # with 22 splits each. + attr_reader :rebalance_chunks + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param file_ids [Array] These are the file ids that will be used to create the vector store. To upload + # files, use the `POST /files` endpoint. + # @param target_splits_per_chunk [Float] This is an optional field which allows you to specify the number of splits you + # want per chunk. If not specified, the default 20 is used. However, you may want + # to use a different number. + # @param split_delimiters [Array] This is an optional field which allows you to specify the delimiters to use when + # splitting the file before chunking the text. If not specified, the default + # [.!?\n] are used to split into sentences. However, you may want to use spaces or + # other delimiters. + # @param rebalance_chunks [Boolean] This is an optional field which allows you to specify whether or not to + # rebalance the chunks created from the file. If not specified, the default true + # is used. If true, Trieve will evenly distribute remainder splits across chunks + # such that 66 splits with a target_splits_per_chunk of 20 will result in 3 chunks + # with 22 splits each. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] + def initialize(file_ids:, target_splits_per_chunk: OMIT, split_delimiters: OMIT, rebalance_chunks: OMIT, + additional_properties: nil) + @file_ids = file_ids + @target_splits_per_chunk = target_splits_per_chunk if target_splits_per_chunk != OMIT + @split_delimiters = split_delimiters if split_delimiters != OMIT + @rebalance_chunks = rebalance_chunks if rebalance_chunks != OMIT + @additional_properties = additional_properties + @_field_set = { + "fileIds": file_ids, + "targetSplitsPerChunk": target_splits_per_chunk, + "splitDelimiters": split_delimiters, + "rebalanceChunks": rebalance_chunks + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of + # TrieveKnowledgeBaseVectorStoreCreatePlan + # + # @param json_object [String] + # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + file_ids = parsed_json["fileIds"] + target_splits_per_chunk = parsed_json["targetSplitsPerChunk"] + split_delimiters = parsed_json["splitDelimiters"] + rebalance_chunks = parsed_json["rebalanceChunks"] + new( + file_ids: file_ids, + target_splits_per_chunk: target_splits_per_chunk, + split_delimiters: split_delimiters, + rebalance_chunks: rebalance_chunks, + additional_properties: struct + ) + end + + # Serialize an instance of TrieveKnowledgeBaseVectorStoreCreatePlan to a JSON + # object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.file_ids.is_a?(Array) != false || raise("Passed value for field obj.file_ids is not the expected type, validation failed.") + obj.target_splits_per_chunk&.is_a?(Float) != false || raise("Passed value for field obj.target_splits_per_chunk is not the expected type, validation failed.") + obj.split_delimiters&.is_a?(Array) != false || raise("Passed value for field obj.split_delimiters is not the expected type, validation failed.") + obj.rebalance_chunks&.is_a?(Boolean) != false || raise("Passed value for field obj.rebalance_chunks is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan.rb b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan.rb new file mode 100644 index 0000000..b3d60eb --- /dev/null +++ b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require_relative "trieve_knowledge_base_vector_store_search_plan_search_type" +require "ostruct" +require "json" + +module Vapi + class TrieveKnowledgeBaseVectorStoreSearchPlan + # @return [Boolean] If true, stop words (specified in server/src/stop-words.txt in the git repo) + # will be removed. This will preserve queries that are entirely stop words. + attr_reader :remove_stop_words + # @return [Float] This is the score threshold to filter out chunks with a score below the + # threshold for cosine distance metric. For Manhattan Distance, Euclidean + # Distance, and Dot Product, it will filter out scores above the threshold + # distance. This threshold applies before weight and bias modifications. If not + # specified, this defaults to no threshold. A threshold of 0 will default to no + # threshold. + attr_reader :score_threshold + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType] This is the search method used when searching for relevant chunks from the + # vector store. + attr_reader :search_type + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param remove_stop_words [Boolean] If true, stop words (specified in server/src/stop-words.txt in the git repo) + # will be removed. This will preserve queries that are entirely stop words. + # @param score_threshold [Float] This is the score threshold to filter out chunks with a score below the + # threshold for cosine distance metric. For Manhattan Distance, Euclidean + # Distance, and Dot Product, it will filter out scores above the threshold + # distance. This threshold applies before weight and bias modifications. If not + # specified, this defaults to no threshold. A threshold of 0 will default to no + # threshold. + # @param search_type [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType] This is the search method used when searching for relevant chunks from the + # vector store. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] + def initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil) + @remove_stop_words = remove_stop_words if remove_stop_words != OMIT + @score_threshold = score_threshold if score_threshold != OMIT + @search_type = search_type + @additional_properties = additional_properties + @_field_set = { + "removeStopWords": remove_stop_words, + "scoreThreshold": score_threshold, + "searchType": search_type + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of + # TrieveKnowledgeBaseVectorStoreSearchPlan + # + # @param json_object [String] + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + remove_stop_words = parsed_json["removeStopWords"] + score_threshold = parsed_json["scoreThreshold"] + search_type = parsed_json["searchType"] + new( + remove_stop_words: remove_stop_words, + score_threshold: score_threshold, + search_type: search_type, + additional_properties: struct + ) + end + + # Serialize an instance of TrieveKnowledgeBaseVectorStoreSearchPlan to a JSON + # object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.remove_stop_words&.is_a?(Boolean) != false || raise("Passed value for field obj.remove_stop_words is not the expected type, validation failed.") + obj.score_threshold&.is_a?(Float) != false || raise("Passed value for field obj.score_threshold is not the expected type, validation failed.") + obj.search_type.is_a?(Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType) != false || raise("Passed value for field obj.search_type is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type.rb b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type.rb new file mode 100644 index 0000000..e24bca0 --- /dev/null +++ b/lib/vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Vapi + # This is the search method used when searching for relevant chunks from the + # vector store. + class TrieveKnowledgeBaseVectorStoreSearchPlanSearchType + FULLTEXT = "fulltext" + SEMANTIC = "semantic" + HYBRID = "hybrid" + BM_25 = "bm25" + end +end diff --git a/lib/vapi_server_sdk/types/twilio_credential.rb b/lib/vapi_server_sdk/types/twilio_credential.rb index bbb5cba..5884803 100644 --- a/lib/vapi_server_sdk/types/twilio_credential.rb +++ b/lib/vapi_server_sdk/types/twilio_credential.rb @@ -18,6 +18,8 @@ class TwilioCredential attr_reader :created_at # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] attr_reader :account_sid # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -34,10 +36,11 @@ class TwilioCredential # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. # @param account_sid [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TwilioCredential] - def initialize(provider:, auth_token:, id:, org_id:, created_at:, updated_at:, account_sid:, + def initialize(provider:, auth_token:, id:, org_id:, created_at:, updated_at:, account_sid:, name: OMIT, additional_properties: nil) @provider = provider @auth_token = auth_token @@ -45,6 +48,7 @@ def initialize(provider:, auth_token:, id:, org_id:, created_at:, updated_at:, a @org_id = org_id @created_at = created_at @updated_at = updated_at + @name = name if name != OMIT @account_sid = account_sid @additional_properties = additional_properties @_field_set = { @@ -54,8 +58,11 @@ def initialize(provider:, auth_token:, id:, org_id:, created_at:, updated_at:, a "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, + "name": name, "accountSid": account_sid - } + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of TwilioCredential @@ -71,6 +78,7 @@ def self.from_json(json_object:) org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] account_sid = parsed_json["accountSid"] new( provider: provider, @@ -79,6 +87,7 @@ def self.from_json(json_object:) org_id: org_id, created_at: created_at, updated_at: updated_at, + name: name, account_sid: account_sid, additional_properties: struct ) @@ -104,6 +113,7 @@ def self.validate_raw(obj:) obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.account_sid.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb b/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb index 334354e..3c048be 100644 --- a/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateAnthropicCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateAnthropicCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAnthropicCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateAnthropicCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb b/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb index 7577bb9..11cc2fa 100644 --- a/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateAnyscaleCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateAnyscaleCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAnyscaleCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateAnyscaleCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb new file mode 100644 index 0000000..75444be --- /dev/null +++ b/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateAssemblyAiCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateAssemblyAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateAssemblyAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateAssemblyAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateAssemblyAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_azure_credential_dto.rb b/lib/vapi_server_sdk/types/update_azure_credential_dto.rb new file mode 100644 index 0000000..a9d7f04 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_azure_credential_dto.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require_relative "update_azure_credential_dto_region" +require "ostruct" +require "json" + +module Vapi + class UpdateAzureCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is the service being used in Azure. + attr_reader :service + # @return [Vapi::UpdateAzureCredentialDtoRegion] This is the region of the Azure resource. + attr_reader :region + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param service [String] This is the service being used in Azure. + # @param region [Vapi::UpdateAzureCredentialDtoRegion] This is the region of the Azure resource. + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateAzureCredentialDto] + def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, additional_properties: nil) + @provider = provider + @service = service + @region = region if region != OMIT + @api_key = api_key if api_key != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "service": service, + "region": region, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateAzureCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateAzureCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + service = parsed_json["service"] + region = parsed_json["region"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + service: service, + region: region, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateAzureCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.region&.is_a?(Vapi::UpdateAzureCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb b/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb new file mode 100644 index 0000000..8fcc0d7 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Vapi + # This is the region of the Azure resource. + class UpdateAzureCredentialDtoRegion + AUSTRALIA = "australia" + CANADA = "canada" + EASTUS_2 = "eastus2" + EASTUS = "eastus" + FRANCE = "france" + INDIA = "india" + JAPAN = "japan" + UAENORTH = "uaenorth" + NORTHCENTRALUS = "northcentralus" + NORWAY = "norway" + SOUTHCENTRALUS = "southcentralus" + SWEDEN = "sweden" + SWITZERLAND = "switzerland" + UK = "uk" + WESTUS = "westus" + WESTUS_3 = "westus3" + end +end diff --git a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb index 58f1240..2576c68 100644 --- a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb @@ -17,6 +17,8 @@ class UpdateAzureOpenAiCredentialDto attr_reader :open_ai_key # @return [String] attr_reader :open_ai_endpoint + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -30,22 +32,27 @@ class UpdateAzureOpenAiCredentialDto # @param models [Array] # @param open_ai_key [String] This is not returned in the API. # @param open_ai_endpoint [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAzureOpenAiCredentialDto] - def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, additional_properties: nil) + def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, name: OMIT, additional_properties: nil) @provider = provider @region = region @models = models @open_ai_key = open_ai_key @open_ai_endpoint = open_ai_endpoint + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "region": region, "models": models, "openAIKey": open_ai_key, - "openAIEndpoint": open_ai_endpoint - } + "openAIEndpoint": open_ai_endpoint, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateAzureOpenAiCredentialDto @@ -60,12 +67,14 @@ def self.from_json(json_object:) models = parsed_json["models"] open_ai_key = parsed_json["openAIKey"] open_ai_endpoint = parsed_json["openAIEndpoint"] + name = parsed_json["name"] new( provider: provider, region: region, models: models, open_ai_key: open_ai_key, open_ai_endpoint: open_ai_endpoint, + name: name, additional_properties: struct ) end @@ -89,6 +98,7 @@ def self.validate_raw(obj:) obj.models.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") obj.open_ai_key.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") obj.open_ai_endpoint.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb index 0f13785..c7f792b 100644 --- a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb +++ b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb @@ -2,6 +2,7 @@ module Vapi class UpdateAzureOpenAiCredentialDtoModelsItem + GPT_4_O_20240806 = "gpt-4o-2024-08-06" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O_20240513 = "gpt-4o-2024-05-13" GPT_4_TURBO_20240409 = "gpt-4-turbo-2024-04-09" diff --git a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb index 4c82c5c..e4bc45f 100644 --- a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb @@ -9,6 +9,7 @@ class UpdateAzureOpenAiCredentialDtoRegion FRANCE = "france" INDIA = "india" JAPAN = "japan" + UAENORTH = "uaenorth" NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" diff --git a/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb b/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb index 5cedaaf..c44cbd4 100644 --- a/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb @@ -12,8 +12,6 @@ class UpdateByoSipTrunkCredentialDto attr_reader :provider # @return [Array] This is the list of SIP trunk's gateways. attr_reader :gateways - # @return [String] This is the name of the SIP trunk. This is just for your reference. - attr_reader :name # @return [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. attr_reader :outbound_authentication_plan @@ -23,10 +21,18 @@ class UpdateByoSipTrunkCredentialDto # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false attr_reader :outbound_leading_plus_enabled + # @return [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + attr_reader :tech_prefix + # @return [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. + attr_reader :sip_diversion_header # @return [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. attr_reader :sbc_configuration + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -37,7 +43,6 @@ class UpdateByoSipTrunkCredentialDto # @param provider [String] This can be used to bring your own SIP trunks or to connect to a Carrier. # @param gateways [Array] This is the list of SIP trunk's gateways. - # @param name [String] This is the name of the SIP trunk. This is just for your reference. # @param outbound_authentication_plan [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. # @param outbound_leading_plus_enabled [Boolean] This ensures the outbound origination attempts have a leading plus. Defaults to @@ -45,27 +50,36 @@ class UpdateByoSipTrunkCredentialDto # Usage: # - Vonage/Twilio requires leading plus for all outbound calls. Set this to true. # @default false + # @param tech_prefix [String] This can be used to configure the tech prefix on outbound calls. This is an + # advanced property. + # @param sip_diversion_header [String] This can be used to enable the SIP diversion header for authenticating the + # calling number if the SIP trunk supports it. This is an advanced property. # @param sbc_configuration [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateByoSipTrunkCredentialDto] - def initialize(gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, - outbound_leading_plus_enabled: OMIT, sbc_configuration: OMIT, additional_properties: nil) + def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, + tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil) @provider = provider if provider != OMIT @gateways = gateways - @name = name if name != OMIT @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT + @tech_prefix = tech_prefix if tech_prefix != OMIT + @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT @sbc_configuration = sbc_configuration if sbc_configuration != OMIT + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "gateways": gateways, - "name": name, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, - "sbcConfiguration": sbc_configuration + "techPrefix": tech_prefix, + "sipDiversionHeader": sip_diversion_header, + "sbcConfiguration": sbc_configuration, + "name": name }.reject do |_k, v| v == OMIT end @@ -83,7 +97,6 @@ def self.from_json(json_object:) item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) end - name = parsed_json["name"] if parsed_json["outboundAuthenticationPlan"].nil? outbound_authentication_plan = nil else @@ -91,19 +104,24 @@ def self.from_json(json_object:) outbound_authentication_plan = Vapi::SipTrunkOutboundAuthenticationPlan.from_json(json_object: outbound_authentication_plan) end outbound_leading_plus_enabled = parsed_json["outboundLeadingPlusEnabled"] + tech_prefix = parsed_json["techPrefix"] + sip_diversion_header = parsed_json["sipDiversionHeader"] if parsed_json["sbcConfiguration"].nil? sbc_configuration = nil else sbc_configuration = parsed_json["sbcConfiguration"].to_json sbc_configuration = Vapi::SbcConfiguration.from_json(json_object: sbc_configuration) end + name = parsed_json["name"] new( provider: provider, gateways: gateways, - name: name, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, + tech_prefix: tech_prefix, + sip_diversion_header: sip_diversion_header, sbc_configuration: sbc_configuration, + name: name, additional_properties: struct ) end @@ -124,10 +142,12 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") - obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") + obj.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.") + obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.") obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb b/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb index 9ec7c11..e8aa06b 100644 --- a/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateCartesiaCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateCartesiaCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateCartesiaCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateCartesiaCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb b/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb index a3df725..1e77cfc 100644 --- a/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "o_auth_2_authentication_plan" require "ostruct" require "json" @@ -9,6 +10,11 @@ class UpdateCustomLlmCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey + attr_reader :authentication_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +25,25 @@ class UpdateCustomLlmCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use + # Bearer authentication, use apiKey + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateCustomLlmCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @authentication_plan = authentication_plan if authentication_plan != OMIT + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { + "provider": provider, + "apiKey": api_key, + "authenticationPlan": authentication_plan, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateCustomLlmCredentialDto @@ -37,9 +55,18 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + if parsed_json["authenticationPlan"].nil? + authentication_plan = nil + else + authentication_plan = parsed_json["authenticationPlan"].to_json + authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan) + end + name = parsed_json["name"] new( provider: provider, api_key: api_key, + authentication_plan: authentication_plan, + name: name, additional_properties: struct ) end @@ -60,6 +87,8 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb b/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb index 2279c5e..45bac0a 100644 --- a/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateDeepInfraCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateDeepInfraCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateDeepInfraCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateDeepInfraCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb b/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb index 9682c6b..6204f9f 100644 --- a/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb @@ -12,6 +12,8 @@ class UpdateDeepgramCredentialDto # @return [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. attr_reader :api_url + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -24,14 +26,16 @@ class UpdateDeepgramCredentialDto # @param api_key [String] This is not returned in the API. # @param api_url [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateDeepgramCredentialDto] - def initialize(provider:, api_key:, api_url: OMIT, additional_properties: nil) + def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @api_url = api_url if api_url != OMIT + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url }.reject do |_k, v| + @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| v == OMIT end end @@ -46,10 +50,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] api_url = parsed_json["apiUrl"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, api_url: api_url, + name: name, additional_properties: struct ) end @@ -71,6 +77,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb b/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb index 8d28627..ef1ccc0 100644 --- a/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateElevenLabsCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateElevenLabsCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateElevenLabsCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateElevenLabsCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb b/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb index 445cb4c..72d1572 100644 --- a/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb @@ -9,8 +9,6 @@ module Vapi class UpdateGcpCredentialDto # @return [String] attr_reader :provider - # @return [String] This is the name of the GCP credential. This is just for your reference. - attr_reader :name # @return [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. @@ -18,6 +16,8 @@ class UpdateGcpCredentialDto attr_reader :gcp_key # @return [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. attr_reader :bucket_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -27,25 +27,25 @@ class UpdateGcpCredentialDto OMIT = Object.new # @param provider [String] - # @param name [String] This is the name of the GCP credential. This is just for your reference. # @param gcp_key [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. # The schema is identical to the JSON that GCP outputs. # @param bucket_plan [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGcpCredentialDto] - def initialize(provider:, gcp_key:, name: OMIT, bucket_plan: OMIT, additional_properties: nil) + def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_properties: nil) @provider = provider - @name = name if name != OMIT @gcp_key = gcp_key @bucket_plan = bucket_plan if bucket_plan != OMIT + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, - "name": name, "gcpKey": gcp_key, - "bucketPlan": bucket_plan + "bucketPlan": bucket_plan, + "name": name }.reject do |_k, v| v == OMIT end @@ -59,7 +59,6 @@ def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] - name = parsed_json["name"] if parsed_json["gcpKey"].nil? gcp_key = nil else @@ -72,11 +71,12 @@ def self.from_json(json_object:) bucket_plan = parsed_json["bucketPlan"].to_json bucket_plan = Vapi::BucketPlan.from_json(json_object: bucket_plan) end + name = parsed_json["name"] new( provider: provider, - name: name, gcp_key: gcp_key, bucket_plan: bucket_plan, + name: name, additional_properties: struct ) end @@ -96,9 +96,9 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") Vapi::GcpKey.validate_raw(obj: obj.gcp_key) obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb b/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb index b38a71b..3753ea9 100644 --- a/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateGladiaCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateGladiaCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGladiaCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateGladiaCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb b/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb index 963b4a7..5570de8 100644 --- a/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateGoHighLevelCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateGoHighLevelCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGoHighLevelCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateGoHighLevelCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_google_credential_dto.rb b/lib/vapi_server_sdk/types/update_google_credential_dto.rb new file mode 100644 index 0000000..41485dc --- /dev/null +++ b/lib/vapi_server_sdk/types/update_google_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateGoogleCredentialDto + # @return [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the key for Gemini in Google AI Studio. Get it from here: + # https://aistudio.google.com/app/apikey + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateGoogleCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateGoogleCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateGoogleCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateGoogleCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_groq_credential_dto.rb b/lib/vapi_server_sdk/types/update_groq_credential_dto.rb index b6c1217..79fe7f1 100644 --- a/lib/vapi_server_sdk/types/update_groq_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_groq_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateGroqCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateGroqCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGroqCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateGroqCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb new file mode 100644 index 0000000..f2ac228 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateInflectionAiCredentialDto + # @return [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Pi in InflectionAI's console. Get it from here: + # https://developers.inflection.ai/keys, billing will need to be setup + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateInflectionAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateInflectionAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateInflectionAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateInflectionAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb b/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb new file mode 100644 index 0000000..f82ac04 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateLangfuseCredentialDto + # @return [String] + attr_reader :provider + # @return [String] The public key for Langfuse project. Eg: pk-lf-... + attr_reader :public_key + # @return [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + attr_reader :api_key + # @return [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + attr_reader :api_url + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param public_key [String] The public key for Langfuse project. Eg: pk-lf-... + # @param api_key [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the + # API. + # @param api_url [String] The host URL for Langfuse project. Eg: https://cloud.langfuse.com + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateLangfuseCredentialDto] + def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additional_properties: nil) + @provider = provider + @public_key = public_key + @api_key = api_key + @api_url = api_url + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "publicKey": public_key, + "apiKey": api_key, + "apiUrl": api_url, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateLangfuseCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateLangfuseCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + public_key = parsed_json["publicKey"] + api_key = parsed_json["apiKey"] + api_url = parsed_json["apiUrl"] + name = parsed_json["name"] + new( + provider: provider, + public_key: public_key, + api_key: api_key, + api_url: api_url, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateLangfuseCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.public_key.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_url.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb b/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb index a03313c..1e2da63 100644 --- a/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateLmntCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateLmntCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateLmntCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateLmntCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_make_credential_dto.rb b/lib/vapi_server_sdk/types/update_make_credential_dto.rb index 3c29456..38e80ac 100644 --- a/lib/vapi_server_sdk/types/update_make_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_make_credential_dto.rb @@ -13,6 +13,8 @@ class UpdateMakeCredentialDto attr_reader :region # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -25,15 +27,25 @@ class UpdateMakeCredentialDto # @param team_id [String] Team ID # @param region [String] Region of your application. For example: eu1, eu2, us1, us2 # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateMakeCredentialDto] - def initialize(provider:, team_id:, region:, api_key:, additional_properties: nil) + def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @team_id = team_id @region = region @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "teamId": team_id, "region": region, "apiKey": api_key } + @_field_set = { + "provider": provider, + "teamId": team_id, + "region": region, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateMakeCredentialDto @@ -47,11 +59,13 @@ def self.from_json(json_object:) team_id = parsed_json["teamId"] region = parsed_json["region"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, team_id: team_id, region: region, api_key: api_key, + name: name, additional_properties: struct ) end @@ -74,6 +88,7 @@ def self.validate_raw(obj:) obj.team_id.is_a?(String) != false || raise("Passed value for field obj.team_id is not the expected type, validation failed.") obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb index b94c0b8..b40cef6 100644 --- a/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateOpenAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateOpenAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOpenAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateOpenAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb b/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb index c49237f..4b6b3ce 100644 --- a/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateOpenRouterCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateOpenRouterCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOpenRouterCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateOpenRouterCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_org_dto.rb b/lib/vapi_server_sdk/types/update_org_dto.rb index a335fa5..f74e6db 100644 --- a/lib/vapi_server_sdk/types/update_org_dto.rb +++ b/lib/vapi_server_sdk/types/update_org_dto.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require_relative "update_org_dto_channel" require "ostruct" require "json" @@ -13,8 +14,13 @@ class UpdateOrgDto # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. attr_reader :hipaa_enabled + # @return [String] This is the ID of the subscription the org belongs to. + attr_reader :subscription_id # @return [String] This is the name of the org. This is just for your own reference. attr_reader :name + # @return [Vapi::UpdateOrgDtoChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + attr_reader :channel # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit @@ -45,7 +51,10 @@ class UpdateOrgDto # available for LLM and Voice respectively. # This is due to the compliance requirements of HIPAA. Other providers may not # meet these requirements. + # @param subscription_id [String] This is the ID of the subscription the org belongs to. # @param name [String] This is the name of the org. This is just for your own reference. + # @param channel [Vapi::UpdateOrgDtoChannel] This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This @@ -59,10 +68,12 @@ class UpdateOrgDto # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOrgDto] - def initialize(hipaa_enabled: OMIT, name: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, - concurrency_limit: OMIT, additional_properties: nil) + def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, + server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT + @subscription_id = subscription_id if subscription_id != OMIT @name = name if name != OMIT + @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT @server_url = server_url if server_url != OMIT @server_url_secret = server_url_secret if server_url_secret != OMIT @@ -70,7 +81,9 @@ def initialize(hipaa_enabled: OMIT, name: OMIT, billing_limit: OMIT, server_url: @additional_properties = additional_properties @_field_set = { "hipaaEnabled": hipaa_enabled, + "subscriptionId": subscription_id, "name": name, + "channel": channel, "billingLimit": billing_limit, "serverUrl": server_url, "serverUrlSecret": server_url_secret, @@ -88,14 +101,18 @@ def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) hipaa_enabled = parsed_json["hipaaEnabled"] + subscription_id = parsed_json["subscriptionId"] name = parsed_json["name"] + channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] server_url = parsed_json["serverUrl"] server_url_secret = parsed_json["serverUrlSecret"] concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, + subscription_id: subscription_id, name: name, + channel: channel, billing_limit: billing_limit, server_url: server_url, server_url_secret: server_url_secret, @@ -119,7 +136,9 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.") + obj.subscription_id&.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.channel&.is_a?(Vapi::UpdateOrgDtoChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/update_org_dto_channel.rb b/lib/vapi_server_sdk/types/update_org_dto_channel.rb new file mode 100644 index 0000000..c9ae5da --- /dev/null +++ b/lib/vapi_server_sdk/types/update_org_dto_channel.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Vapi + # This is the channel of the org. There is the cluster the API traffic for the org + # will be directed. + class UpdateOrgDtoChannel + DEFAULT = "default" + WEEKLY = "weekly" + end +end diff --git a/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb index 575e4de..d24fe7e 100644 --- a/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb @@ -9,6 +9,8 @@ class UpdatePerplexityAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdatePerplexityAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdatePerplexityAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdatePerplexityAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb b/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb index a5d4065..973f271 100644 --- a/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb @@ -11,6 +11,8 @@ class UpdatePlayHtCredentialDto attr_reader :api_key # @return [String] attr_reader :user_id + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,18 @@ class UpdatePlayHtCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. # @param user_id [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdatePlayHtCredentialDto] - def initialize(provider:, api_key:, user_id:, additional_properties: nil) + def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key @user_id = user_id + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id } + @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdatePlayHtCredentialDto @@ -42,10 +48,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] user_id = parsed_json["userId"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, user_id: user_id, + name: name, additional_properties: struct ) end @@ -67,6 +75,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb index 73364ef..1716608 100644 --- a/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateRimeAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateRimeAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateRimeAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateRimeAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb b/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb index e834247..8ee96d2 100644 --- a/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateRunpodCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateRunpodCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateRunpodCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateRunpodCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb b/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb index 8409d65..8ff6f27 100644 --- a/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb @@ -17,6 +17,8 @@ class UpdateS3CredentialDto attr_reader :s_3_bucket_name # @return [String] The path prefix for the uploaded recording. Ex. "recordings/" attr_reader :s_3_path_prefix + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -31,16 +33,18 @@ class UpdateS3CredentialDto # @param region [String] AWS region in which the S3 bucket is located. # @param s_3_bucket_name [String] AWS S3 bucket name. # @param s_3_path_prefix [String] The path prefix for the uploaded recording. Ex. "recordings/" + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateS3CredentialDto] def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, - additional_properties: nil) + name: OMIT, additional_properties: nil) @provider = provider @aws_access_key_id = aws_access_key_id @aws_secret_access_key = aws_secret_access_key @region = region @s_3_bucket_name = s_3_bucket_name @s_3_path_prefix = s_3_path_prefix + @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -48,8 +52,11 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s "awsSecretAccessKey": aws_secret_access_key, "region": region, "s3BucketName": s_3_bucket_name, - "s3PathPrefix": s_3_path_prefix - } + "s3PathPrefix": s_3_path_prefix, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateS3CredentialDto @@ -65,6 +72,7 @@ def self.from_json(json_object:) region = parsed_json["region"] s_3_bucket_name = parsed_json["s3BucketName"] s_3_path_prefix = parsed_json["s3PathPrefix"] + name = parsed_json["name"] new( provider: provider, aws_access_key_id: aws_access_key_id, @@ -72,6 +80,7 @@ def self.from_json(json_object:) region: region, s_3_bucket_name: s_3_bucket_name, s_3_path_prefix: s_3_path_prefix, + name: name, additional_properties: struct ) end @@ -96,6 +105,7 @@ def self.validate_raw(obj:) obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.s_3_bucket_name.is_a?(String) != false || raise("Passed value for field obj.s_3_bucket_name is not the expected type, validation failed.") obj.s_3_path_prefix.is_a?(String) != false || raise("Passed value for field obj.s_3_path_prefix is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb b/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb new file mode 100644 index 0000000..c003673 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateTavusCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTavusCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTavusCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateTavusCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTavusCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb index 5c05b32..a5e0e42 100644 --- a/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb @@ -9,6 +9,8 @@ class UpdateTogetherAiCredentialDto attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,13 +21,17 @@ class UpdateTogetherAiCredentialDto # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateTogetherAiCredentialDto] - def initialize(provider:, api_key:, additional_properties: nil) + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key } + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateTogetherAiCredentialDto @@ -37,9 +43,11 @@ def self.from_json(json_object:) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_key: api_key, + name: name, additional_properties: struct ) end @@ -60,6 +68,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb b/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb index dc86d41..d6c166a 100644 --- a/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb @@ -11,6 +11,8 @@ class UpdateTwilioCredentialDto attr_reader :auth_token # @return [String] attr_reader :account_sid + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,23 @@ class UpdateTwilioCredentialDto # @param provider [String] # @param auth_token [String] This is not returned in the API. # @param account_sid [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateTwilioCredentialDto] - def initialize(provider:, auth_token:, account_sid:, additional_properties: nil) + def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_properties: nil) @provider = provider @auth_token = auth_token @account_sid = account_sid + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "authToken": auth_token, "accountSid": account_sid } + @_field_set = { + "provider": provider, + "authToken": auth_token, + "accountSid": account_sid, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateTwilioCredentialDto @@ -42,10 +53,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] auth_token = parsed_json["authToken"] account_sid = parsed_json["accountSid"] + name = parsed_json["name"] new( provider: provider, auth_token: auth_token, account_sid: account_sid, + name: name, additional_properties: struct ) end @@ -67,6 +80,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.auth_token.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.") obj.account_sid.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb b/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb index f6e7757..e74b793 100644 --- a/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb @@ -11,6 +11,8 @@ class UpdateVonageCredentialDto attr_reader :api_secret # @return [String] attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,14 +24,23 @@ class UpdateVonageCredentialDto # @param provider [String] # @param api_secret [String] This is not returned in the API. # @param api_key [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateVonageCredentialDto] - def initialize(provider:, api_secret:, api_key:, additional_properties: nil) + def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properties: nil) @provider = provider @api_secret = api_secret @api_key = api_key + @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiSecret": api_secret, "apiKey": api_key } + @_field_set = { + "provider": provider, + "apiSecret": api_secret, + "apiKey": api_key, + "name": name + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of UpdateVonageCredentialDto @@ -42,10 +53,12 @@ def self.from_json(json_object:) provider = parsed_json["provider"] api_secret = parsed_json["apiSecret"] api_key = parsed_json["apiKey"] + name = parsed_json["name"] new( provider: provider, api_secret: api_secret, api_key: api_key, + name: name, additional_properties: struct ) end @@ -67,6 +80,7 @@ def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_secret.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb new file mode 100644 index 0000000..8b95dd9 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateXAiCredentialDto + # @return [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateXAiCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateXAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateXAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateXAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/vapi_cost.rb b/lib/vapi_server_sdk/types/vapi_cost.rb index 1d64ab5..cf6a553 100644 --- a/lib/vapi_server_sdk/types/vapi_cost.rb +++ b/lib/vapi_server_sdk/types/vapi_cost.rb @@ -1,10 +1,13 @@ # frozen_string_literal: true +require_relative "vapi_cost_sub_type" require "ostruct" require "json" module Vapi class VapiCost + # @return [Vapi::VapiCostSubType] This is the sub type of the cost. + attr_reader :sub_type # @return [Float] This is the minutes of Vapi usage. This should match `call.endedAt` - # `call.startedAt`. attr_reader :minutes @@ -18,16 +21,18 @@ class VapiCost OMIT = Object.new + # @param sub_type [Vapi::VapiCostSubType] This is the sub type of the cost. # @param minutes [Float] This is the minutes of Vapi usage. This should match `call.endedAt` - # `call.startedAt`. # @param cost [Float] This is the cost of the component in USD. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VapiCost] - def initialize(minutes:, cost:, additional_properties: nil) + def initialize(sub_type:, minutes:, cost:, additional_properties: nil) + @sub_type = sub_type @minutes = minutes @cost = cost @additional_properties = additional_properties - @_field_set = { "minutes": minutes, "cost": cost } + @_field_set = { "subType": sub_type, "minutes": minutes, "cost": cost } end # Deserialize a JSON object to an instance of VapiCost @@ -37,9 +42,11 @@ def initialize(minutes:, cost:, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) + sub_type = parsed_json["subType"] minutes = parsed_json["minutes"] cost = parsed_json["cost"] new( + sub_type: sub_type, minutes: minutes, cost: cost, additional_properties: struct @@ -60,6 +67,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) + obj.sub_type.is_a?(Vapi::VapiCostSubType) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") obj.minutes.is_a?(Float) != false || raise("Passed value for field obj.minutes is not the expected type, validation failed.") obj.cost.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/vapi_cost_sub_type.rb b/lib/vapi_server_sdk/types/vapi_cost_sub_type.rb new file mode 100644 index 0000000..dbe6708 --- /dev/null +++ b/lib/vapi_server_sdk/types/vapi_cost_sub_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the sub type of the cost. + class VapiCostSubType + NORMAL = "normal" + OVERAGE = "overage" + end +end diff --git a/lib/vapi_server_sdk/types/vapi_model.rb b/lib/vapi_server_sdk/types/vapi_model.rb index 63abce4..7605988 100644 --- a/lib/vapi_server_sdk/types/vapi_model.rb +++ b/lib/vapi_server_sdk/types/vapi_model.rb @@ -2,8 +2,8 @@ require_relative "open_ai_message" require_relative "vapi_model_tools_item" +require_relative "create_custom_knowledge_base_dto" require_relative "vapi_model_steps_item" -require_relative "knowledge_base" require "ostruct" require "json" @@ -19,6 +19,10 @@ class VapiModel # tools, use `tools`. # Both `tools` and `toolIds` can be used together. attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id # @return [Array] attr_reader :steps # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b @@ -26,8 +30,6 @@ class VapiModel # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature - # @return [Vapi::KnowledgeBase] These are the options for the knowledge base. - attr_reader :knowledge_base # @return [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. attr_reader :max_tokens @@ -58,11 +60,12 @@ class VapiModel # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient # tools, use `tools`. # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param steps [Array] # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. - # @param knowledge_base [Vapi::KnowledgeBase] These are the options for the knowledge base. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate # in each turn of the conversation. Default is 250. # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as @@ -77,15 +80,16 @@ class VapiModel # @default 0 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VapiModel] - def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, steps: OMIT, temperature: OMIT, - knowledge_base: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + steps: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @steps = steps if steps != OMIT @model = model @temperature = temperature if temperature != OMIT - @knowledge_base = knowledge_base if knowledge_base != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @num_fast_turns = num_fast_turns if num_fast_turns != OMIT @@ -94,10 +98,11 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, steps: OMIT, "messages": messages, "tools": tools, "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, "steps": steps, "model": model, "temperature": temperature, - "knowledgeBase": knowledge_base, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, "numFastTurns": num_fast_turns @@ -122,18 +127,19 @@ def self.from_json(json_object:) Vapi::VapiModelToolsItem.from_json(json_object: item) end tool_ids = parsed_json["toolIds"] + if parsed_json["knowledgeBase"].nil? + knowledge_base = nil + else + knowledge_base = parsed_json["knowledgeBase"].to_json + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) + end + knowledge_base_id = parsed_json["knowledgeBaseId"] steps = parsed_json["steps"]&.map do |item| item = item.to_json Vapi::VapiModelStepsItem.from_json(json_object: item) end model = parsed_json["model"] temperature = parsed_json["temperature"] - if parsed_json["knowledgeBase"].nil? - knowledge_base = nil - else - knowledge_base = parsed_json["knowledgeBase"].to_json - knowledge_base = Vapi::KnowledgeBase.from_json(json_object: knowledge_base) - end max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] num_fast_turns = parsed_json["numFastTurns"] @@ -141,10 +147,11 @@ def self.from_json(json_object:) messages: messages, tools: tools, tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, steps: steps, model: model, temperature: temperature, - knowledge_base: knowledge_base, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, num_fast_turns: num_fast_turns, @@ -169,10 +176,11 @@ def self.validate_raw(obj:) obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.steps&.is_a?(Array) != false || raise("Passed value for field obj.steps is not the expected type, validation failed.") obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") - obj.knowledge_base.nil? || Vapi::KnowledgeBase.validate_raw(obj: obj.knowledge_base) obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/vapi_phone_number.rb b/lib/vapi_server_sdk/types/vapi_phone_number.rb index 6311854..b3bd7d7 100644 --- a/lib/vapi_server_sdk/types/vapi_phone_number.rb +++ b/lib/vapi_server_sdk/types/vapi_phone_number.rb @@ -2,6 +2,7 @@ require_relative "vapi_phone_number_fallback_destination" require "date" +require_relative "sip_authentication" require "ostruct" require "json" @@ -48,6 +49,10 @@ class VapiPhoneNumber # attached to this number will answer. # This is case-insensitive. attr_reader :sip_uri + # @return [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. + attr_reader :authentication # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -86,10 +91,13 @@ class VapiPhoneNumber # @param sip_uri [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant # attached to this number will answer. # This is case-insensitive. + # @param authentication [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VapiPhoneNumber] def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, authentication: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @id = id @org_id = org_id @@ -101,6 +109,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destin @server_url = server_url if server_url != OMIT @server_url_secret = server_url_secret if server_url_secret != OMIT @sip_uri = sip_uri + @authentication = authentication if authentication != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -113,7 +122,8 @@ def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destin "squadId": squad_id, "serverUrl": server_url, "serverUrlSecret": server_url_secret, - "sipUri": sip_uri + "sipUri": sip_uri, + "authentication": authentication }.reject do |_k, v| v == OMIT end @@ -142,6 +152,12 @@ def self.from_json(json_object:) server_url = parsed_json["serverUrl"] server_url_secret = parsed_json["serverUrlSecret"] sip_uri = parsed_json["sipUri"] + if parsed_json["authentication"].nil? + authentication = nil + else + authentication = parsed_json["authentication"].to_json + authentication = Vapi::SipAuthentication.from_json(json_object: authentication) + end new( fallback_destination: fallback_destination, id: id, @@ -154,6 +170,7 @@ def self.from_json(json_object:) server_url: server_url, server_url_secret: server_url_secret, sip_uri: sip_uri, + authentication: authentication, additional_properties: struct ) end @@ -183,6 +200,7 @@ def self.validate_raw(obj:) obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") + obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication) end end end diff --git a/lib/vapi_server_sdk/types/vonage_credential.rb b/lib/vapi_server_sdk/types/vonage_credential.rb index dc4f112..8bd7fa4 100644 --- a/lib/vapi_server_sdk/types/vonage_credential.rb +++ b/lib/vapi_server_sdk/types/vonage_credential.rb @@ -23,6 +23,8 @@ class VonageCredential # @return [String] This is the Vonage Application ID for the credential. # Only relevant for Vonage credentials. attr_reader :vonage_application_id + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] attr_reader :api_key # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -42,11 +44,12 @@ class VonageCredential # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. # @param vonage_application_id [String] This is the Vonage Application ID for the credential. # Only relevant for Vonage credentials. + # @param name [String] This is the name of credential. This is just for your reference. # @param api_key [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VonageCredential] def initialize(vonage_application_private_key:, provider:, api_secret:, id:, org_id:, created_at:, updated_at:, - vonage_application_id:, api_key:, additional_properties: nil) + vonage_application_id:, api_key:, name: OMIT, additional_properties: nil) @vonage_application_private_key = vonage_application_private_key @provider = provider @api_secret = api_secret @@ -55,6 +58,7 @@ def initialize(vonage_application_private_key:, provider:, api_secret:, id:, org @created_at = created_at @updated_at = updated_at @vonage_application_id = vonage_application_id + @name = name if name != OMIT @api_key = api_key @additional_properties = additional_properties @_field_set = { @@ -66,8 +70,11 @@ def initialize(vonage_application_private_key:, provider:, api_secret:, id:, org "createdAt": created_at, "updatedAt": updated_at, "vonageApplicationId": vonage_application_id, + "name": name, "apiKey": api_key - } + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of VonageCredential @@ -85,6 +92,7 @@ def self.from_json(json_object:) created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) vonage_application_id = parsed_json["vonageApplicationId"] + name = parsed_json["name"] api_key = parsed_json["apiKey"] new( vonage_application_private_key: vonage_application_private_key, @@ -95,6 +103,7 @@ def self.from_json(json_object:) created_at: created_at, updated_at: updated_at, vonage_application_id: vonage_application_id, + name: name, api_key: api_key, additional_properties: struct ) @@ -122,6 +131,7 @@ def self.validate_raw(obj:) obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.vonage_application_id.is_a?(String) != false || raise("Passed value for field obj.vonage_application_id is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/webhook_credential.rb b/lib/vapi_server_sdk/types/webhook_credential.rb new file mode 100644 index 0000000..515e2fc --- /dev/null +++ b/lib/vapi_server_sdk/types/webhook_credential.rb @@ -0,0 +1,134 @@ +# frozen_string_literal: true + +require_relative "o_auth_2_authentication_plan" +require "date" +require_relative "oauth_2_authentication_session" +require "ostruct" +require "json" + +module Vapi + class WebhookCredential + # @return [String] + attr_reader :provider + # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. + attr_reader :authentication_plan + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [Vapi::Oauth2AuthenticationSession] This is the authentication session for the credential. Available for credentials + # that have an authentication plan. + attr_reader :authentication_session + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param authentication_session [Vapi::Oauth2AuthenticationSession] This is the authentication session for the credential. Available for credentials + # that have an authentication plan. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::WebhookCredential] + def initialize(provider:, authentication_plan:, id:, org_id:, created_at:, updated_at:, authentication_session:, + name: OMIT, additional_properties: nil) + @provider = provider + @authentication_plan = authentication_plan + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @authentication_session = authentication_session + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "authenticationPlan": authentication_plan, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "authenticationSession": authentication_session, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of WebhookCredential + # + # @param json_object [String] + # @return [Vapi::WebhookCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + if parsed_json["authenticationPlan"].nil? + authentication_plan = nil + else + authentication_plan = parsed_json["authenticationPlan"].to_json + authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan) + end + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + if parsed_json["authenticationSession"].nil? + authentication_session = nil + else + authentication_session = parsed_json["authenticationSession"].to_json + authentication_session = Vapi::Oauth2AuthenticationSession.from_json(json_object: authentication_session) + end + name = parsed_json["name"] + new( + provider: provider, + authentication_plan: authentication_plan, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + authentication_session: authentication_session, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of WebhookCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + Vapi::Oauth2AuthenticationSession.validate_raw(obj: obj.authentication_session) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/x_ai_credential.rb b/lib/vapi_server_sdk/types/x_ai_credential.rb new file mode 100644 index 0000000..7e2ae44 --- /dev/null +++ b/lib/vapi_server_sdk/types/x_ai_credential.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class XAiCredential + # @return [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] This is the api key for Grok in XAi's console. Get it from here: + # https://console.x.ai + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::XAiCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of XAiCredential + # + # @param json_object [String] + # @return [Vapi::XAiCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of XAiCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/xai_model.rb b/lib/vapi_server_sdk/types/xai_model.rb new file mode 100644 index 0000000..5f29c96 --- /dev/null +++ b/lib/vapi_server_sdk/types/xai_model.rb @@ -0,0 +1,177 @@ +# frozen_string_literal: true + +require_relative "open_ai_message" +require_relative "xai_model_tools_item" +require_relative "create_custom_knowledge_base_dto" +require "ostruct" +require "json" + +module Vapi + class XaiModel + # @return [Array] This is the starting state for the conversation. + attr_reader :messages + # @return [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tools + # @return [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id + # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + attr_reader :model + # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + attr_reader :temperature + # @return [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + attr_reader :max_tokens + # @return [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + attr_reader :emotion_recognition_enabled + # @return [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + attr_reader :num_fast_turns + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] This is the starting state for the conversation. + # @param tools [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. + # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + # @param num_fast_turns [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::XaiModel] + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + @messages = messages if messages != OMIT + @tools = tools if tools != OMIT + @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT + @model = model + @temperature = temperature if temperature != OMIT + @max_tokens = max_tokens if max_tokens != OMIT + @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT + @num_fast_turns = num_fast_turns if num_fast_turns != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "tools": tools, + "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, + "model": model, + "temperature": temperature, + "maxTokens": max_tokens, + "emotionRecognitionEnabled": emotion_recognition_enabled, + "numFastTurns": num_fast_turns + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of XaiModel + # + # @param json_object [String] + # @return [Vapi::XaiModel] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + tools = parsed_json["tools"]&.map do |item| + item = item.to_json + Vapi::XaiModelToolsItem.from_json(json_object: item) + end + tool_ids = parsed_json["toolIds"] + if parsed_json["knowledgeBase"].nil? + knowledge_base = nil + else + knowledge_base = parsed_json["knowledgeBase"].to_json + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) + end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] + max_tokens = parsed_json["maxTokens"] + emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] + num_fast_turns = parsed_json["numFastTurns"] + new( + messages: messages, + tools: tools, + tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, + model: model, + temperature: temperature, + max_tokens: max_tokens, + emotion_recognition_enabled: emotion_recognition_enabled, + num_fast_turns: num_fast_turns, + additional_properties: struct + ) + end + + # Serialize an instance of XaiModel to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") + obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") + obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") + obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") + obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") + obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/xai_model_tools_item.rb b/lib/vapi_server_sdk/types/xai_model_tools_item.rb new file mode 100644 index 0000000..a6f383b --- /dev/null +++ b/lib/vapi_server_sdk/types/xai_model_tools_item.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_dtmf_tool_dto" +require_relative "create_end_call_tool_dto" +require_relative "create_voicemail_tool_dto" +require_relative "create_function_tool_dto" +require_relative "create_ghl_tool_dto" +require_relative "create_make_tool_dto" +require_relative "create_transfer_call_tool_dto" + +module Vapi + class XaiModelToolsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::XaiModelToolsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of XaiModelToolsItem + # + # @param json_object [String] + # @return [Vapi::XaiModelToolsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::CreateEndCallToolDto.from_json(json_object: json_object) + when "voicemail" + Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) + when "function" + Vapi::CreateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::CreateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) + else + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "voicemail" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::CreateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::CreateEndCallToolDto.validate_raw(obj: obj) + when "voicemail" + Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) + when "function" + Vapi::CreateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::CreateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateDtmfToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::CreateEndCallToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::CreateVoicemailToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.voicemail(member:) + new(member: member, discriminant: "voicemail") + end + + # @param member [Vapi::CreateFunctionToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::CreateGhlToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::CreateMakeToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateTransferCallToolDto] + # @return [Vapi::XaiModelToolsItem] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + end +end diff --git a/vapi_server_sdk.gemspec b/vapi_server_sdk.gemspec index c85a763..860e67d 100644 --- a/vapi_server_sdk.gemspec +++ b/vapi_server_sdk.gemspec @@ -4,7 +4,7 @@ require_relative "lib/gemconfig" Gem::Specification.new do |spec| spec.name = "vapi_server_sdk" - spec.version = "0.1.0" + spec.version = "0.2.0" spec.authors = Vapi::Gemconfig::AUTHORS spec.email = Vapi::Gemconfig::EMAIL spec.summary = Vapi::Gemconfig::SUMMARY