vapi-server-sdk 0.0.0a7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vapi/__init__.py +1081 -0
- vapi/analytics/__init__.py +2 -0
- vapi/analytics/client.py +159 -0
- vapi/assistants/__init__.py +21 -0
- vapi/assistants/client.py +1593 -0
- vapi/assistants/types/__init__.py +19 -0
- vapi/assistants/types/update_assistant_dto_background_sound.py +5 -0
- vapi/assistants/types/update_assistant_dto_client_messages_item.py +23 -0
- vapi/assistants/types/update_assistant_dto_first_message_mode.py +10 -0
- vapi/assistants/types/update_assistant_dto_model.py +26 -0
- vapi/assistants/types/update_assistant_dto_server_messages_item.py +24 -0
- vapi/assistants/types/update_assistant_dto_transcriber.py +8 -0
- vapi/assistants/types/update_assistant_dto_voice.py +24 -0
- vapi/blocks/__init__.py +25 -0
- vapi/blocks/client.py +804 -0
- vapi/blocks/types/__init__.py +23 -0
- vapi/blocks/types/blocks_create_request.py +8 -0
- vapi/blocks/types/blocks_create_response.py +8 -0
- vapi/blocks/types/blocks_delete_response.py +8 -0
- vapi/blocks/types/blocks_get_response.py +8 -0
- vapi/blocks/types/blocks_list_response_item.py +8 -0
- vapi/blocks/types/blocks_update_response.py +8 -0
- vapi/blocks/types/update_block_dto_messages_item.py +7 -0
- vapi/blocks/types/update_block_dto_steps_item.py +7 -0
- vapi/blocks/types/update_block_dto_tool.py +20 -0
- vapi/calls/__init__.py +2 -0
- vapi/calls/client.py +776 -0
- vapi/client.py +172 -0
- vapi/core/__init__.py +50 -0
- vapi/core/api_error.py +15 -0
- vapi/core/client_wrapper.py +76 -0
- vapi/core/datetime_utils.py +28 -0
- vapi/core/file.py +62 -0
- vapi/core/http_client.py +487 -0
- vapi/core/jsonable_encoder.py +101 -0
- vapi/core/pagination.py +88 -0
- vapi/core/pydantic_utilities.py +296 -0
- vapi/core/query_encoder.py +58 -0
- vapi/core/remove_none_from_dict.py +11 -0
- vapi/core/request_options.py +32 -0
- vapi/core/serialization.py +272 -0
- vapi/environment.py +7 -0
- vapi/errors/__init__.py +5 -0
- vapi/errors/bad_request_error.py +9 -0
- vapi/files/__init__.py +2 -0
- vapi/files/client.py +544 -0
- vapi/logs/__init__.py +5 -0
- vapi/logs/client.py +367 -0
- vapi/logs/types/__init__.py +6 -0
- vapi/logs/types/logs_get_request_sort_order.py +5 -0
- vapi/logs/types/logs_get_request_type.py +5 -0
- vapi/phone_numbers/__init__.py +21 -0
- vapi/phone_numbers/client.py +735 -0
- vapi/phone_numbers/types/__init__.py +19 -0
- vapi/phone_numbers/types/phone_numbers_create_request.py +11 -0
- vapi/phone_numbers/types/phone_numbers_create_response.py +9 -0
- vapi/phone_numbers/types/phone_numbers_delete_response.py +9 -0
- vapi/phone_numbers/types/phone_numbers_get_response.py +9 -0
- vapi/phone_numbers/types/phone_numbers_list_response_item.py +9 -0
- vapi/phone_numbers/types/phone_numbers_update_response.py +9 -0
- vapi/phone_numbers/types/update_phone_number_dto_fallback_destination.py +7 -0
- vapi/py.typed +0 -0
- vapi/squads/__init__.py +2 -0
- vapi/squads/client.py +723 -0
- vapi/tools/__init__.py +21 -0
- vapi/tools/client.py +717 -0
- vapi/tools/types/__init__.py +19 -0
- vapi/tools/types/tools_create_request.py +20 -0
- vapi/tools/types/tools_create_response.py +12 -0
- vapi/tools/types/tools_delete_response.py +12 -0
- vapi/tools/types/tools_get_response.py +12 -0
- vapi/tools/types/tools_list_response_item.py +14 -0
- vapi/tools/types/tools_update_response.py +12 -0
- vapi/tools/types/update_tool_dto_messages_item.py +9 -0
- vapi/types/__init__.py +993 -0
- vapi/types/add_voice_to_provider_dto.py +34 -0
- vapi/types/analysis.py +38 -0
- vapi/types/analysis_cost.py +52 -0
- vapi/types/analysis_cost_analysis_type.py +5 -0
- vapi/types/analysis_cost_breakdown.py +80 -0
- vapi/types/analysis_plan.py +43 -0
- vapi/types/analytics_operation.py +34 -0
- vapi/types/analytics_operation_column.py +19 -0
- vapi/types/analytics_operation_operation.py +5 -0
- vapi/types/analytics_query.py +51 -0
- vapi/types/analytics_query_group_by_item.py +7 -0
- vapi/types/analytics_query_result.py +42 -0
- vapi/types/anthropic_credential.py +46 -0
- vapi/types/anthropic_model.py +91 -0
- vapi/types/anthropic_model_model.py +10 -0
- vapi/types/anthropic_model_tools_item.py +20 -0
- vapi/types/anyscale_credential.py +46 -0
- vapi/types/anyscale_model.py +90 -0
- vapi/types/anyscale_model_tools_item.py +20 -0
- vapi/types/artifact.py +66 -0
- vapi/types/artifact_messages_item.py +10 -0
- vapi/types/artifact_plan.py +70 -0
- vapi/types/assignment_mutation.py +85 -0
- vapi/types/assignment_mutation_conditions_item.py +7 -0
- vapi/types/assistant.py +330 -0
- vapi/types/assistant_background_sound.py +5 -0
- vapi/types/assistant_client_messages_item.py +23 -0
- vapi/types/assistant_first_message_mode.py +10 -0
- vapi/types/assistant_model.py +26 -0
- vapi/types/assistant_overrides.py +316 -0
- vapi/types/assistant_overrides_background_sound.py +5 -0
- vapi/types/assistant_overrides_client_messages_item.py +23 -0
- vapi/types/assistant_overrides_first_message_mode.py +10 -0
- vapi/types/assistant_overrides_model.py +26 -0
- vapi/types/assistant_overrides_server_messages_item.py +24 -0
- vapi/types/assistant_overrides_transcriber.py +8 -0
- vapi/types/assistant_overrides_voice.py +24 -0
- vapi/types/assistant_server_messages_item.py +24 -0
- vapi/types/assistant_transcriber.py +8 -0
- vapi/types/assistant_voice.py +24 -0
- vapi/types/azure_open_ai_credential.py +52 -0
- vapi/types/azure_open_ai_credential_models_item.py +17 -0
- vapi/types/azure_open_ai_credential_region.py +24 -0
- vapi/types/azure_voice.py +52 -0
- vapi/types/azure_voice_id.py +6 -0
- vapi/types/azure_voice_id_enum.py +5 -0
- vapi/types/block_complete_message.py +33 -0
- vapi/types/block_complete_message_conditions_item.py +7 -0
- vapi/types/block_start_message.py +33 -0
- vapi/types/block_start_message_conditions_item.py +7 -0
- vapi/types/bot_message.py +54 -0
- vapi/types/bucket_plan.py +72 -0
- vapi/types/buy_phone_number_dto.py +81 -0
- vapi/types/buy_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/byo_phone_number.py +126 -0
- vapi/types/byo_phone_number_fallback_destination.py +7 -0
- vapi/types/byo_sip_trunk_credential.py +85 -0
- vapi/types/call.py +241 -0
- vapi/types/call_costs_item.py +11 -0
- vapi/types/call_destination.py +7 -0
- vapi/types/call_ended_reason.py +177 -0
- vapi/types/call_messages_item.py +10 -0
- vapi/types/call_paginated_response.py +32 -0
- vapi/types/call_phone_call_provider.py +5 -0
- vapi/types/call_phone_call_transport.py +5 -0
- vapi/types/call_status.py +5 -0
- vapi/types/call_type.py +5 -0
- vapi/types/callback_step.py +116 -0
- vapi/types/callback_step_block.py +11 -0
- vapi/types/cartesia_credential.py +46 -0
- vapi/types/cartesia_voice.py +58 -0
- vapi/types/cartesia_voice_language.py +5 -0
- vapi/types/cartesia_voice_model.py +5 -0
- vapi/types/chunk_plan.py +70 -0
- vapi/types/client_inbound_message.py +23 -0
- vapi/types/client_inbound_message_add_message.py +28 -0
- vapi/types/client_inbound_message_control.py +32 -0
- vapi/types/client_inbound_message_control_control.py +7 -0
- vapi/types/client_inbound_message_message.py +10 -0
- vapi/types/client_inbound_message_say.py +36 -0
- vapi/types/client_message.py +23 -0
- vapi/types/client_message_conversation_update.py +38 -0
- vapi/types/client_message_conversation_update_messages_item.py +12 -0
- vapi/types/client_message_hang.py +27 -0
- vapi/types/client_message_language_changed.py +27 -0
- vapi/types/client_message_message.py +28 -0
- vapi/types/client_message_metadata.py +27 -0
- vapi/types/client_message_model_output.py +27 -0
- vapi/types/client_message_speech_update.py +34 -0
- vapi/types/client_message_speech_update_role.py +5 -0
- vapi/types/client_message_speech_update_status.py +5 -0
- vapi/types/client_message_tool_calls.py +40 -0
- vapi/types/client_message_tool_calls_result.py +31 -0
- vapi/types/client_message_tool_calls_tool_with_tool_call_list_item.py +10 -0
- vapi/types/client_message_transcript.py +43 -0
- vapi/types/client_message_transcript_role.py +5 -0
- vapi/types/client_message_transcript_transcript_type.py +5 -0
- vapi/types/client_message_user_interrupted.py +22 -0
- vapi/types/client_message_voice_input.py +27 -0
- vapi/types/clone_voice_dto.py +37 -0
- vapi/types/condition.py +33 -0
- vapi/types/condition_operator.py +5 -0
- vapi/types/conversation_block.py +109 -0
- vapi/types/conversation_block_messages_item.py +7 -0
- vapi/types/cost_breakdown.py +78 -0
- vapi/types/create_anthropic_credential_dto.py +25 -0
- vapi/types/create_anyscale_credential_dto.py +25 -0
- vapi/types/create_assistant_dto.py +309 -0
- vapi/types/create_assistant_dto_background_sound.py +5 -0
- vapi/types/create_assistant_dto_client_messages_item.py +23 -0
- vapi/types/create_assistant_dto_first_message_mode.py +10 -0
- vapi/types/create_assistant_dto_model.py +26 -0
- vapi/types/create_assistant_dto_server_messages_item.py +24 -0
- vapi/types/create_assistant_dto_transcriber.py +8 -0
- vapi/types/create_assistant_dto_voice.py +24 -0
- vapi/types/create_azure_open_ai_credential_dto.py +31 -0
- vapi/types/create_azure_open_ai_credential_dto_models_item.py +17 -0
- vapi/types/create_azure_open_ai_credential_dto_region.py +24 -0
- vapi/types/create_byo_phone_number_dto.py +105 -0
- vapi/types/create_byo_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/create_byo_sip_trunk_credential_dto.py +64 -0
- vapi/types/create_cartesia_credential_dto.py +25 -0
- vapi/types/create_conversation_block_dto.py +88 -0
- vapi/types/create_conversation_block_dto_messages_item.py +7 -0
- vapi/types/create_custom_llm_credential_dto.py +25 -0
- vapi/types/create_customer_dto.py +59 -0
- vapi/types/create_deep_infra_credential_dto.py +25 -0
- vapi/types/create_deepgram_credential_dto.py +32 -0
- vapi/types/create_dtmf_tool_dto.py +61 -0
- vapi/types/create_dtmf_tool_dto_messages_item.py +11 -0
- vapi/types/create_eleven_labs_credential_dto.py +25 -0
- vapi/types/create_end_call_tool_dto.py +61 -0
- vapi/types/create_end_call_tool_dto_messages_item.py +11 -0
- vapi/types/create_function_tool_dto.py +61 -0
- vapi/types/create_function_tool_dto_messages_item.py +11 -0
- vapi/types/create_gcp_credential_dto.py +41 -0
- vapi/types/create_ghl_tool_dto.py +63 -0
- vapi/types/create_ghl_tool_dto_messages_item.py +11 -0
- vapi/types/create_gladia_credential_dto.py +25 -0
- vapi/types/create_go_high_level_credential_dto.py +25 -0
- vapi/types/create_groq_credential_dto.py +25 -0
- vapi/types/create_lmnt_credential_dto.py +25 -0
- vapi/types/create_make_credential_dto.py +35 -0
- vapi/types/create_make_tool_dto.py +63 -0
- vapi/types/create_make_tool_dto_messages_item.py +11 -0
- vapi/types/create_open_ai_credential_dto.py +25 -0
- vapi/types/create_open_router_credential_dto.py +25 -0
- vapi/types/create_org_dto.py +63 -0
- vapi/types/create_outbound_call_dto.py +104 -0
- vapi/types/create_output_tool_dto.py +61 -0
- vapi/types/create_output_tool_dto_messages_item.py +11 -0
- vapi/types/create_perplexity_ai_credential_dto.py +25 -0
- vapi/types/create_play_ht_credential_dto.py +27 -0
- vapi/types/create_rime_ai_credential_dto.py +25 -0
- vapi/types/create_runpod_credential_dto.py +25 -0
- vapi/types/create_s_3_credential_dto.py +51 -0
- vapi/types/create_squad_dto.py +52 -0
- vapi/types/create_together_ai_credential_dto.py +25 -0
- vapi/types/create_token_dto.py +34 -0
- vapi/types/create_token_dto_tag.py +5 -0
- vapi/types/create_tool_call_block_dto.py +75 -0
- vapi/types/create_tool_call_block_dto_messages_item.py +7 -0
- vapi/types/create_tool_call_block_dto_tool.py +20 -0
- vapi/types/create_tool_template_dto.py +38 -0
- vapi/types/create_tool_template_dto_details.py +20 -0
- vapi/types/create_tool_template_dto_provider.py +5 -0
- vapi/types/create_tool_template_dto_provider_details.py +10 -0
- vapi/types/create_tool_template_dto_visibility.py +5 -0
- vapi/types/create_transfer_call_tool_dto.py +67 -0
- vapi/types/create_transfer_call_tool_dto_destinations_item.py +11 -0
- vapi/types/create_transfer_call_tool_dto_messages_item.py +11 -0
- vapi/types/create_twilio_credential_dto.py +27 -0
- vapi/types/create_twilio_phone_number_dto.py +92 -0
- vapi/types/create_twilio_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/create_vapi_phone_number_dto.py +84 -0
- vapi/types/create_vapi_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/create_voicemail_tool_dto.py +65 -0
- vapi/types/create_voicemail_tool_dto_messages_item.py +11 -0
- vapi/types/create_vonage_credential_dto.py +27 -0
- vapi/types/create_vonage_phone_number_dto.py +87 -0
- vapi/types/create_vonage_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/create_web_call_dto.py +63 -0
- vapi/types/create_workflow_block_dto.py +78 -0
- vapi/types/create_workflow_block_dto_messages_item.py +7 -0
- vapi/types/create_workflow_block_dto_steps_item.py +10 -0
- vapi/types/custom_llm_credential.py +46 -0
- vapi/types/custom_llm_model.py +115 -0
- vapi/types/custom_llm_model_metadata_send_mode.py +5 -0
- vapi/types/custom_llm_model_tools_item.py +20 -0
- vapi/types/deep_infra_credential.py +46 -0
- vapi/types/deep_infra_model.py +90 -0
- vapi/types/deep_infra_model_tools_item.py +20 -0
- vapi/types/deepgram_credential.py +53 -0
- vapi/types/deepgram_transcriber.py +68 -0
- vapi/types/deepgram_transcriber_language.py +65 -0
- vapi/types/deepgram_transcriber_model.py +37 -0
- vapi/types/deepgram_voice.py +47 -0
- vapi/types/deepgram_voice_id.py +6 -0
- vapi/types/deepgram_voice_id_enum.py +10 -0
- vapi/types/dtmf_tool.py +82 -0
- vapi/types/dtmf_tool_messages_item.py +9 -0
- vapi/types/eleven_labs_credential.py +46 -0
- vapi/types/eleven_labs_voice.py +98 -0
- vapi/types/eleven_labs_voice_id.py +6 -0
- vapi/types/eleven_labs_voice_id_enum.py +24 -0
- vapi/types/eleven_labs_voice_model.py +8 -0
- vapi/types/end_call_tool.py +82 -0
- vapi/types/end_call_tool_messages_item.py +9 -0
- vapi/types/error.py +19 -0
- vapi/types/exact_replacement.py +40 -0
- vapi/types/file.py +57 -0
- vapi/types/file_status.py +5 -0
- vapi/types/format_plan.py +64 -0
- vapi/types/format_plan_replacements_item.py +7 -0
- vapi/types/function_tool.py +82 -0
- vapi/types/function_tool_messages_item.py +9 -0
- vapi/types/function_tool_provider_details.py +35 -0
- vapi/types/function_tool_with_tool_call.py +67 -0
- vapi/types/function_tool_with_tool_call_messages_item.py +11 -0
- vapi/types/gcp_credential.py +62 -0
- vapi/types/gcp_key.py +78 -0
- vapi/types/ghl_tool.py +85 -0
- vapi/types/ghl_tool_messages_item.py +9 -0
- vapi/types/ghl_tool_metadata.py +22 -0
- vapi/types/ghl_tool_provider_details.py +41 -0
- vapi/types/ghl_tool_with_tool_call.py +69 -0
- vapi/types/ghl_tool_with_tool_call_messages_item.py +11 -0
- vapi/types/gladia_credential.py +46 -0
- vapi/types/gladia_transcriber.py +56 -0
- vapi/types/gladia_transcriber_language.py +109 -0
- vapi/types/gladia_transcriber_language_behaviour.py +7 -0
- vapi/types/gladia_transcriber_model.py +5 -0
- vapi/types/go_high_level_credential.py +46 -0
- vapi/types/groq_credential.py +46 -0
- vapi/types/groq_model.py +91 -0
- vapi/types/groq_model_model.py +19 -0
- vapi/types/groq_model_tools_item.py +20 -0
- vapi/types/handoff_step.py +116 -0
- vapi/types/handoff_step_block.py +11 -0
- vapi/types/import_twilio_phone_number_dto.py +91 -0
- vapi/types/import_twilio_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/import_vonage_phone_number_dto.py +88 -0
- vapi/types/import_vonage_phone_number_dto_fallback_destination.py +7 -0
- vapi/types/invite_user_dto.py +21 -0
- vapi/types/invite_user_dto_role.py +5 -0
- vapi/types/json_schema.py +57 -0
- vapi/types/json_schema_type.py +5 -0
- vapi/types/knowledge_base.py +23 -0
- vapi/types/lmnt_credential.py +46 -0
- vapi/types/lmnt_voice.py +52 -0
- vapi/types/lmnt_voice_id.py +6 -0
- vapi/types/lmnt_voice_id_enum.py +5 -0
- vapi/types/log.py +164 -0
- vapi/types/log_request_http_method.py +5 -0
- vapi/types/log_resource.py +7 -0
- vapi/types/log_type.py +5 -0
- vapi/types/logs_paginated_response.py +22 -0
- vapi/types/make_credential.py +56 -0
- vapi/types/make_tool.py +85 -0
- vapi/types/make_tool_messages_item.py +9 -0
- vapi/types/make_tool_metadata.py +22 -0
- vapi/types/make_tool_provider_details.py +40 -0
- vapi/types/make_tool_with_tool_call.py +69 -0
- vapi/types/make_tool_with_tool_call_messages_item.py +11 -0
- vapi/types/message_plan.py +51 -0
- vapi/types/metrics.py +44 -0
- vapi/types/model_based_condition.py +54 -0
- vapi/types/model_cost.py +53 -0
- vapi/types/monitor.py +33 -0
- vapi/types/monitor_plan.py +43 -0
- vapi/types/neets_voice.py +47 -0
- vapi/types/neets_voice_id.py +6 -0
- vapi/types/neets_voice_id_enum.py +5 -0
- vapi/types/open_ai_credential.py +46 -0
- vapi/types/open_ai_function.py +35 -0
- vapi/types/open_ai_function_parameters.py +35 -0
- vapi/types/open_ai_message.py +21 -0
- vapi/types/open_ai_message_role.py +5 -0
- vapi/types/open_ai_model.py +106 -0
- vapi/types/open_ai_model_fallback_models_item.py +26 -0
- vapi/types/open_ai_model_model.py +26 -0
- vapi/types/open_ai_model_tools_item.py +20 -0
- vapi/types/open_ai_voice.py +52 -0
- vapi/types/open_ai_voice_id.py +5 -0
- vapi/types/open_router_credential.py +46 -0
- vapi/types/open_router_model.py +90 -0
- vapi/types/open_router_model_tools_item.py +20 -0
- vapi/types/org.py +120 -0
- vapi/types/org_plan.py +28 -0
- vapi/types/output_tool.py +82 -0
- vapi/types/output_tool_messages_item.py +9 -0
- vapi/types/pagination_meta.py +23 -0
- vapi/types/perplexity_ai_credential.py +46 -0
- vapi/types/perplexity_ai_model.py +90 -0
- vapi/types/perplexity_ai_model_tools_item.py +20 -0
- vapi/types/play_ht_credential.py +48 -0
- vapi/types/play_ht_voice.py +84 -0
- vapi/types/play_ht_voice_emotion.py +21 -0
- vapi/types/play_ht_voice_id.py +6 -0
- vapi/types/play_ht_voice_id_enum.py +8 -0
- vapi/types/punctuation_boundary.py +7 -0
- vapi/types/regex_option.py +34 -0
- vapi/types/regex_option_type.py +5 -0
- vapi/types/regex_replacement.py +48 -0
- vapi/types/rime_ai_credential.py +46 -0
- vapi/types/rime_ai_voice.py +58 -0
- vapi/types/rime_ai_voice_id.py +6 -0
- vapi/types/rime_ai_voice_id_enum.py +90 -0
- vapi/types/rime_ai_voice_model.py +5 -0
- vapi/types/rule_based_condition.py +96 -0
- vapi/types/rule_based_condition_operator.py +5 -0
- vapi/types/runpod_credential.py +46 -0
- vapi/types/s_3_credential.py +72 -0
- vapi/types/sbc_configuration.py +17 -0
- vapi/types/server.py +40 -0
- vapi/types/server_message.py +40 -0
- vapi/types/server_message_assistant_request.py +96 -0
- vapi/types/server_message_assistant_request_phone_number.py +11 -0
- vapi/types/server_message_conversation_update.py +110 -0
- vapi/types/server_message_conversation_update_messages_item.py +12 -0
- vapi/types/server_message_conversation_update_phone_number.py +11 -0
- vapi/types/server_message_end_of_call_report.py +134 -0
- vapi/types/server_message_end_of_call_report_costs_item.py +13 -0
- vapi/types/server_message_end_of_call_report_ended_reason.py +177 -0
- vapi/types/server_message_end_of_call_report_phone_number.py +11 -0
- vapi/types/server_message_hang.py +101 -0
- vapi/types/server_message_hang_phone_number.py +11 -0
- vapi/types/server_message_language_changed.py +101 -0
- vapi/types/server_message_language_changed_phone_number.py +11 -0
- vapi/types/server_message_message.py +38 -0
- vapi/types/server_message_model_output.py +101 -0
- vapi/types/server_message_model_output_phone_number.py +11 -0
- vapi/types/server_message_phone_call_control.py +110 -0
- vapi/types/server_message_phone_call_control_destination.py +7 -0
- vapi/types/server_message_phone_call_control_phone_number.py +11 -0
- vapi/types/server_message_phone_call_control_request.py +5 -0
- vapi/types/server_message_response.py +39 -0
- vapi/types/server_message_response_assistant_request.py +80 -0
- vapi/types/server_message_response_assistant_request_destination.py +7 -0
- vapi/types/server_message_response_message_response.py +14 -0
- vapi/types/server_message_response_tool_calls.py +28 -0
- vapi/types/server_message_response_transfer_destination_request.py +32 -0
- vapi/types/server_message_response_transfer_destination_request_destination.py +11 -0
- vapi/types/server_message_response_voice_request.py +44 -0
- vapi/types/server_message_speech_update.py +108 -0
- vapi/types/server_message_speech_update_phone_number.py +11 -0
- vapi/types/server_message_speech_update_role.py +5 -0
- vapi/types/server_message_speech_update_status.py +5 -0
- vapi/types/server_message_status_update.py +145 -0
- vapi/types/server_message_status_update_destination.py +7 -0
- vapi/types/server_message_status_update_ended_reason.py +177 -0
- vapi/types/server_message_status_update_messages_item.py +12 -0
- vapi/types/server_message_status_update_phone_number.py +11 -0
- vapi/types/server_message_status_update_status.py +7 -0
- vapi/types/server_message_tool_calls.py +112 -0
- vapi/types/server_message_tool_calls_phone_number.py +11 -0
- vapi/types/server_message_tool_calls_tool_with_tool_call_list_item.py +10 -0
- vapi/types/server_message_transcript.py +115 -0
- vapi/types/server_message_transcript_phone_number.py +11 -0
- vapi/types/server_message_transcript_role.py +5 -0
- vapi/types/server_message_transcript_transcript_type.py +5 -0
- vapi/types/server_message_transfer_destination_request.py +98 -0
- vapi/types/server_message_transfer_destination_request_phone_number.py +11 -0
- vapi/types/server_message_transfer_update.py +116 -0
- vapi/types/server_message_transfer_update_destination.py +11 -0
- vapi/types/server_message_transfer_update_phone_number.py +11 -0
- vapi/types/server_message_user_interrupted.py +96 -0
- vapi/types/server_message_user_interrupted_phone_number.py +11 -0
- vapi/types/server_message_voice_input.py +101 -0
- vapi/types/server_message_voice_input_phone_number.py +11 -0
- vapi/types/server_message_voice_request.py +128 -0
- vapi/types/server_message_voice_request_phone_number.py +11 -0
- vapi/types/sip_trunk_gateway.py +79 -0
- vapi/types/sip_trunk_gateway_outbound_protocol.py +5 -0
- vapi/types/sip_trunk_outbound_authentication_plan.py +35 -0
- vapi/types/sip_trunk_outbound_sip_register_plan.py +21 -0
- vapi/types/squad.py +73 -0
- vapi/types/squad_member_dto.py +60 -0
- vapi/types/start_speaking_plan.py +62 -0
- vapi/types/step_destination.py +28 -0
- vapi/types/step_destination_conditions_item.py +7 -0
- vapi/types/stop_speaking_plan.py +65 -0
- vapi/types/structured_data_plan.py +66 -0
- vapi/types/success_evaluation_plan.py +75 -0
- vapi/types/success_evaluation_plan_rubric.py +17 -0
- vapi/types/summary_plan.py +56 -0
- vapi/types/sync_voice_library_dto.py +23 -0
- vapi/types/sync_voice_library_dto_providers_item.py +10 -0
- vapi/types/system_message.py +39 -0
- vapi/types/talkscriber_transcriber.py +33 -0
- vapi/types/talkscriber_transcriber_language.py +109 -0
- vapi/types/template.py +58 -0
- vapi/types/template_details.py +20 -0
- vapi/types/template_provider.py +5 -0
- vapi/types/template_provider_details.py +8 -0
- vapi/types/template_visibility.py +5 -0
- vapi/types/time_range.py +47 -0
- vapi/types/time_range_step.py +8 -0
- vapi/types/together_ai_credential.py +46 -0
- vapi/types/together_ai_model.py +90 -0
- vapi/types/together_ai_model_tools_item.py +20 -0
- vapi/types/token.py +62 -0
- vapi/types/token_restrictions.py +53 -0
- vapi/types/token_tag.py +5 -0
- vapi/types/tool_call.py +33 -0
- vapi/types/tool_call_block.py +96 -0
- vapi/types/tool_call_block_messages_item.py +7 -0
- vapi/types/tool_call_block_tool.py +20 -0
- vapi/types/tool_call_function.py +27 -0
- vapi/types/tool_call_message.py +46 -0
- vapi/types/tool_call_result.py +62 -0
- vapi/types/tool_call_result_message.py +49 -0
- vapi/types/tool_call_result_message_item.py +7 -0
- vapi/types/tool_message_complete.py +74 -0
- vapi/types/tool_message_complete_role.py +5 -0
- vapi/types/tool_message_delayed.py +49 -0
- vapi/types/tool_message_failed.py +50 -0
- vapi/types/tool_message_start.py +37 -0
- vapi/types/tool_template_metadata.py +23 -0
- vapi/types/tool_template_setup.py +24 -0
- vapi/types/transcriber_cost.py +46 -0
- vapi/types/transcript_plan.py +66 -0
- vapi/types/transcription_endpointing_plan.py +52 -0
- vapi/types/transfer_call_tool.py +88 -0
- vapi/types/transfer_call_tool_destinations_item.py +11 -0
- vapi/types/transfer_call_tool_messages_item.py +11 -0
- vapi/types/transfer_destination_assistant.py +90 -0
- vapi/types/transfer_destination_number.py +77 -0
- vapi/types/transfer_destination_sip.py +39 -0
- vapi/types/transfer_destination_step.py +39 -0
- vapi/types/transfer_mode.py +5 -0
- vapi/types/transport_configuration_twilio.py +55 -0
- vapi/types/transport_configuration_twilio_recording_channels.py +5 -0
- vapi/types/transport_cost.py +32 -0
- vapi/types/twilio_credential.py +48 -0
- vapi/types/twilio_phone_number.py +113 -0
- vapi/types/twilio_phone_number_fallback_destination.py +7 -0
- vapi/types/twilio_voicemail_detection.py +107 -0
- vapi/types/twilio_voicemail_detection_voicemail_detection_types_item.py +10 -0
- vapi/types/update_anthropic_credential_dto.py +25 -0
- vapi/types/update_anyscale_credential_dto.py +25 -0
- vapi/types/update_azure_open_ai_credential_dto.py +31 -0
- vapi/types/update_azure_open_ai_credential_dto_models_item.py +17 -0
- vapi/types/update_azure_open_ai_credential_dto_region.py +24 -0
- vapi/types/update_byo_sip_trunk_credential_dto.py +64 -0
- vapi/types/update_cartesia_credential_dto.py +25 -0
- vapi/types/update_custom_llm_credential_dto.py +25 -0
- vapi/types/update_deep_infra_credential_dto.py +25 -0
- vapi/types/update_deepgram_credential_dto.py +32 -0
- vapi/types/update_eleven_labs_credential_dto.py +25 -0
- vapi/types/update_gcp_credential_dto.py +41 -0
- vapi/types/update_gladia_credential_dto.py +25 -0
- vapi/types/update_go_high_level_credential_dto.py +25 -0
- vapi/types/update_groq_credential_dto.py +25 -0
- vapi/types/update_lmnt_credential_dto.py +25 -0
- vapi/types/update_make_credential_dto.py +35 -0
- vapi/types/update_open_ai_credential_dto.py +25 -0
- vapi/types/update_open_router_credential_dto.py +25 -0
- vapi/types/update_org_dto.py +63 -0
- vapi/types/update_perplexity_ai_credential_dto.py +25 -0
- vapi/types/update_play_ht_credential_dto.py +27 -0
- vapi/types/update_rime_ai_credential_dto.py +25 -0
- vapi/types/update_runpod_credential_dto.py +25 -0
- vapi/types/update_s_3_credential_dto.py +51 -0
- vapi/types/update_together_ai_credential_dto.py +25 -0
- vapi/types/update_tool_template_dto.py +38 -0
- vapi/types/update_tool_template_dto_details.py +20 -0
- vapi/types/update_tool_template_dto_provider.py +5 -0
- vapi/types/update_tool_template_dto_provider_details.py +10 -0
- vapi/types/update_tool_template_dto_visibility.py +5 -0
- vapi/types/update_twilio_credential_dto.py +27 -0
- vapi/types/update_user_role_dto.py +23 -0
- vapi/types/update_user_role_dto_role.py +5 -0
- vapi/types/update_vonage_credential_dto.py +27 -0
- vapi/types/user.py +47 -0
- vapi/types/user_message.py +49 -0
- vapi/types/vapi_cost.py +32 -0
- vapi/types/vapi_model.py +102 -0
- vapi/types/vapi_model_steps_item.py +7 -0
- vapi/types/vapi_model_tools_item.py +20 -0
- vapi/types/vapi_phone_number.py +105 -0
- vapi/types/vapi_phone_number_fallback_destination.py +7 -0
- vapi/types/voice_cost.py +46 -0
- vapi/types/voice_library.py +126 -0
- vapi/types/voice_library_gender.py +5 -0
- vapi/types/voice_library_voice_response.py +27 -0
- vapi/types/vonage_credential.py +64 -0
- vapi/types/vonage_phone_number.py +108 -0
- vapi/types/vonage_phone_number_fallback_destination.py +7 -0
- vapi/types/workflow_block.py +99 -0
- vapi/types/workflow_block_messages_item.py +7 -0
- vapi/types/workflow_block_steps_item.py +7 -0
- vapi/version.py +3 -0
- vapi_server_sdk-0.0.0a7.dist-info/METADATA +179 -0
- vapi_server_sdk-0.0.0a7.dist-info/RECORD +571 -0
- vapi_server_sdk-0.0.0a7.dist-info/WHEEL +4 -0
vapi/tools/client.py
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
import datetime as dt
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from .types.tools_list_response_item import ToolsListResponseItem
|
|
8
|
+
from ..core.datetime_utils import serialize_datetime
|
|
9
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from json.decoder import JSONDecodeError
|
|
11
|
+
from ..core.api_error import ApiError
|
|
12
|
+
from .types.tools_create_request import ToolsCreateRequest
|
|
13
|
+
from .types.tools_create_response import ToolsCreateResponse
|
|
14
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
15
|
+
from .types.tools_get_response import ToolsGetResponse
|
|
16
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
17
|
+
from .types.tools_delete_response import ToolsDeleteResponse
|
|
18
|
+
from .types.update_tool_dto_messages_item import UpdateToolDtoMessagesItem
|
|
19
|
+
from ..types.open_ai_function import OpenAiFunction
|
|
20
|
+
from ..types.server import Server
|
|
21
|
+
from .types.tools_update_response import ToolsUpdateResponse
|
|
22
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
23
|
+
|
|
24
|
+
# this is used as the default value for optional parameters
|
|
25
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ToolsClient:
|
|
29
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
30
|
+
self._client_wrapper = client_wrapper
|
|
31
|
+
|
|
32
|
+
def list(
|
|
33
|
+
self,
|
|
34
|
+
*,
|
|
35
|
+
limit: typing.Optional[float] = None,
|
|
36
|
+
created_at_gt: typing.Optional[dt.datetime] = None,
|
|
37
|
+
created_at_lt: typing.Optional[dt.datetime] = None,
|
|
38
|
+
created_at_ge: typing.Optional[dt.datetime] = None,
|
|
39
|
+
created_at_le: typing.Optional[dt.datetime] = None,
|
|
40
|
+
updated_at_gt: typing.Optional[dt.datetime] = None,
|
|
41
|
+
updated_at_lt: typing.Optional[dt.datetime] = None,
|
|
42
|
+
updated_at_ge: typing.Optional[dt.datetime] = None,
|
|
43
|
+
updated_at_le: typing.Optional[dt.datetime] = None,
|
|
44
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
45
|
+
) -> typing.List[ToolsListResponseItem]:
|
|
46
|
+
"""
|
|
47
|
+
Parameters
|
|
48
|
+
----------
|
|
49
|
+
limit : typing.Optional[float]
|
|
50
|
+
This is the maximum number of items to return. Defaults to 100.
|
|
51
|
+
|
|
52
|
+
created_at_gt : typing.Optional[dt.datetime]
|
|
53
|
+
This will return items where the createdAt is greater than the specified value.
|
|
54
|
+
|
|
55
|
+
created_at_lt : typing.Optional[dt.datetime]
|
|
56
|
+
This will return items where the createdAt is less than the specified value.
|
|
57
|
+
|
|
58
|
+
created_at_ge : typing.Optional[dt.datetime]
|
|
59
|
+
This will return items where the createdAt is greater than or equal to the specified value.
|
|
60
|
+
|
|
61
|
+
created_at_le : typing.Optional[dt.datetime]
|
|
62
|
+
This will return items where the createdAt is less than or equal to the specified value.
|
|
63
|
+
|
|
64
|
+
updated_at_gt : typing.Optional[dt.datetime]
|
|
65
|
+
This will return items where the updatedAt is greater than the specified value.
|
|
66
|
+
|
|
67
|
+
updated_at_lt : typing.Optional[dt.datetime]
|
|
68
|
+
This will return items where the updatedAt is less than the specified value.
|
|
69
|
+
|
|
70
|
+
updated_at_ge : typing.Optional[dt.datetime]
|
|
71
|
+
This will return items where the updatedAt is greater than or equal to the specified value.
|
|
72
|
+
|
|
73
|
+
updated_at_le : typing.Optional[dt.datetime]
|
|
74
|
+
This will return items where the updatedAt is less than or equal to the specified value.
|
|
75
|
+
|
|
76
|
+
request_options : typing.Optional[RequestOptions]
|
|
77
|
+
Request-specific configuration.
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
typing.List[ToolsListResponseItem]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
Examples
|
|
85
|
+
--------
|
|
86
|
+
from vapi import Vapi
|
|
87
|
+
|
|
88
|
+
client = Vapi(
|
|
89
|
+
token="YOUR_TOKEN",
|
|
90
|
+
)
|
|
91
|
+
client.tools.list()
|
|
92
|
+
"""
|
|
93
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
94
|
+
"tool",
|
|
95
|
+
method="GET",
|
|
96
|
+
params={
|
|
97
|
+
"limit": limit,
|
|
98
|
+
"createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
|
|
99
|
+
"createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
|
|
100
|
+
"createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
|
|
101
|
+
"createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
|
|
102
|
+
"updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
|
|
103
|
+
"updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
|
|
104
|
+
"updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
|
|
105
|
+
"updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
|
|
106
|
+
},
|
|
107
|
+
request_options=request_options,
|
|
108
|
+
)
|
|
109
|
+
try:
|
|
110
|
+
if 200 <= _response.status_code < 300:
|
|
111
|
+
return typing.cast(
|
|
112
|
+
typing.List[ToolsListResponseItem],
|
|
113
|
+
parse_obj_as(
|
|
114
|
+
type_=typing.List[ToolsListResponseItem], # type: ignore
|
|
115
|
+
object_=_response.json(),
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
_response_json = _response.json()
|
|
119
|
+
except JSONDecodeError:
|
|
120
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
121
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
122
|
+
|
|
123
|
+
def create(
|
|
124
|
+
self, *, request: ToolsCreateRequest, request_options: typing.Optional[RequestOptions] = None
|
|
125
|
+
) -> ToolsCreateResponse:
|
|
126
|
+
"""
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
request : ToolsCreateRequest
|
|
130
|
+
|
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
|
132
|
+
Request-specific configuration.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
ToolsCreateResponse
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Examples
|
|
140
|
+
--------
|
|
141
|
+
from vapi import CreateDtmfToolDto, Vapi
|
|
142
|
+
|
|
143
|
+
client = Vapi(
|
|
144
|
+
token="YOUR_TOKEN",
|
|
145
|
+
)
|
|
146
|
+
client.tools.create(
|
|
147
|
+
request=CreateDtmfToolDto(),
|
|
148
|
+
)
|
|
149
|
+
"""
|
|
150
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
151
|
+
"tool",
|
|
152
|
+
method="POST",
|
|
153
|
+
json=convert_and_respect_annotation_metadata(
|
|
154
|
+
object_=request, annotation=ToolsCreateRequest, direction="write"
|
|
155
|
+
),
|
|
156
|
+
request_options=request_options,
|
|
157
|
+
omit=OMIT,
|
|
158
|
+
)
|
|
159
|
+
try:
|
|
160
|
+
if 200 <= _response.status_code < 300:
|
|
161
|
+
return typing.cast(
|
|
162
|
+
ToolsCreateResponse,
|
|
163
|
+
parse_obj_as(
|
|
164
|
+
type_=ToolsCreateResponse, # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
_response_json = _response.json()
|
|
169
|
+
except JSONDecodeError:
|
|
170
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
171
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
172
|
+
|
|
173
|
+
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsGetResponse:
|
|
174
|
+
"""
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
id : str
|
|
178
|
+
|
|
179
|
+
request_options : typing.Optional[RequestOptions]
|
|
180
|
+
Request-specific configuration.
|
|
181
|
+
|
|
182
|
+
Returns
|
|
183
|
+
-------
|
|
184
|
+
ToolsGetResponse
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
Examples
|
|
188
|
+
--------
|
|
189
|
+
from vapi import Vapi
|
|
190
|
+
|
|
191
|
+
client = Vapi(
|
|
192
|
+
token="YOUR_TOKEN",
|
|
193
|
+
)
|
|
194
|
+
client.tools.get(
|
|
195
|
+
id="id",
|
|
196
|
+
)
|
|
197
|
+
"""
|
|
198
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
199
|
+
f"tool/{jsonable_encoder(id)}",
|
|
200
|
+
method="GET",
|
|
201
|
+
request_options=request_options,
|
|
202
|
+
)
|
|
203
|
+
try:
|
|
204
|
+
if 200 <= _response.status_code < 300:
|
|
205
|
+
return typing.cast(
|
|
206
|
+
ToolsGetResponse,
|
|
207
|
+
parse_obj_as(
|
|
208
|
+
type_=ToolsGetResponse, # type: ignore
|
|
209
|
+
object_=_response.json(),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
_response_json = _response.json()
|
|
213
|
+
except JSONDecodeError:
|
|
214
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
215
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
216
|
+
|
|
217
|
+
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsDeleteResponse:
|
|
218
|
+
"""
|
|
219
|
+
Parameters
|
|
220
|
+
----------
|
|
221
|
+
id : str
|
|
222
|
+
|
|
223
|
+
request_options : typing.Optional[RequestOptions]
|
|
224
|
+
Request-specific configuration.
|
|
225
|
+
|
|
226
|
+
Returns
|
|
227
|
+
-------
|
|
228
|
+
ToolsDeleteResponse
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
Examples
|
|
232
|
+
--------
|
|
233
|
+
from vapi import Vapi
|
|
234
|
+
|
|
235
|
+
client = Vapi(
|
|
236
|
+
token="YOUR_TOKEN",
|
|
237
|
+
)
|
|
238
|
+
client.tools.delete(
|
|
239
|
+
id="id",
|
|
240
|
+
)
|
|
241
|
+
"""
|
|
242
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
243
|
+
f"tool/{jsonable_encoder(id)}",
|
|
244
|
+
method="DELETE",
|
|
245
|
+
request_options=request_options,
|
|
246
|
+
)
|
|
247
|
+
try:
|
|
248
|
+
if 200 <= _response.status_code < 300:
|
|
249
|
+
return typing.cast(
|
|
250
|
+
ToolsDeleteResponse,
|
|
251
|
+
parse_obj_as(
|
|
252
|
+
type_=ToolsDeleteResponse, # type: ignore
|
|
253
|
+
object_=_response.json(),
|
|
254
|
+
),
|
|
255
|
+
)
|
|
256
|
+
_response_json = _response.json()
|
|
257
|
+
except JSONDecodeError:
|
|
258
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
259
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
260
|
+
|
|
261
|
+
def update(
|
|
262
|
+
self,
|
|
263
|
+
id: str,
|
|
264
|
+
*,
|
|
265
|
+
async_: typing.Optional[bool] = OMIT,
|
|
266
|
+
messages: typing.Optional[typing.Sequence[UpdateToolDtoMessagesItem]] = OMIT,
|
|
267
|
+
function: typing.Optional[OpenAiFunction] = OMIT,
|
|
268
|
+
server: typing.Optional[Server] = OMIT,
|
|
269
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
270
|
+
) -> ToolsUpdateResponse:
|
|
271
|
+
"""
|
|
272
|
+
Parameters
|
|
273
|
+
----------
|
|
274
|
+
id : str
|
|
275
|
+
|
|
276
|
+
async_ : typing.Optional[bool]
|
|
277
|
+
This determines if the tool is async.
|
|
278
|
+
|
|
279
|
+
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.
|
|
280
|
+
|
|
281
|
+
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.
|
|
282
|
+
|
|
283
|
+
Defaults to synchronous (`false`).
|
|
284
|
+
|
|
285
|
+
messages : typing.Optional[typing.Sequence[UpdateToolDtoMessagesItem]]
|
|
286
|
+
These are the messages that will be spoken to the user as the tool is running.
|
|
287
|
+
|
|
288
|
+
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.
|
|
289
|
+
|
|
290
|
+
function : typing.Optional[OpenAiFunction]
|
|
291
|
+
This is the function definition of the tool.
|
|
292
|
+
|
|
293
|
+
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.
|
|
294
|
+
|
|
295
|
+
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.
|
|
296
|
+
|
|
297
|
+
server : typing.Optional[Server]
|
|
298
|
+
This is the server that will be hit when this tool is requested by the model.
|
|
299
|
+
|
|
300
|
+
All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
|
|
301
|
+
|
|
302
|
+
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.
|
|
303
|
+
|
|
304
|
+
request_options : typing.Optional[RequestOptions]
|
|
305
|
+
Request-specific configuration.
|
|
306
|
+
|
|
307
|
+
Returns
|
|
308
|
+
-------
|
|
309
|
+
ToolsUpdateResponse
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
Examples
|
|
313
|
+
--------
|
|
314
|
+
from vapi import Vapi
|
|
315
|
+
|
|
316
|
+
client = Vapi(
|
|
317
|
+
token="YOUR_TOKEN",
|
|
318
|
+
)
|
|
319
|
+
client.tools.update(
|
|
320
|
+
id="id",
|
|
321
|
+
)
|
|
322
|
+
"""
|
|
323
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
324
|
+
f"tool/{jsonable_encoder(id)}",
|
|
325
|
+
method="PATCH",
|
|
326
|
+
json={
|
|
327
|
+
"async": async_,
|
|
328
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
329
|
+
object_=messages, annotation=typing.Sequence[UpdateToolDtoMessagesItem], direction="write"
|
|
330
|
+
),
|
|
331
|
+
"function": convert_and_respect_annotation_metadata(
|
|
332
|
+
object_=function, annotation=OpenAiFunction, direction="write"
|
|
333
|
+
),
|
|
334
|
+
"server": convert_and_respect_annotation_metadata(object_=server, annotation=Server, direction="write"),
|
|
335
|
+
},
|
|
336
|
+
request_options=request_options,
|
|
337
|
+
omit=OMIT,
|
|
338
|
+
)
|
|
339
|
+
try:
|
|
340
|
+
if 200 <= _response.status_code < 300:
|
|
341
|
+
return typing.cast(
|
|
342
|
+
ToolsUpdateResponse,
|
|
343
|
+
parse_obj_as(
|
|
344
|
+
type_=ToolsUpdateResponse, # type: ignore
|
|
345
|
+
object_=_response.json(),
|
|
346
|
+
),
|
|
347
|
+
)
|
|
348
|
+
_response_json = _response.json()
|
|
349
|
+
except JSONDecodeError:
|
|
350
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
351
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class AsyncToolsClient:
|
|
355
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
356
|
+
self._client_wrapper = client_wrapper
|
|
357
|
+
|
|
358
|
+
async def list(
|
|
359
|
+
self,
|
|
360
|
+
*,
|
|
361
|
+
limit: typing.Optional[float] = None,
|
|
362
|
+
created_at_gt: typing.Optional[dt.datetime] = None,
|
|
363
|
+
created_at_lt: typing.Optional[dt.datetime] = None,
|
|
364
|
+
created_at_ge: typing.Optional[dt.datetime] = None,
|
|
365
|
+
created_at_le: typing.Optional[dt.datetime] = None,
|
|
366
|
+
updated_at_gt: typing.Optional[dt.datetime] = None,
|
|
367
|
+
updated_at_lt: typing.Optional[dt.datetime] = None,
|
|
368
|
+
updated_at_ge: typing.Optional[dt.datetime] = None,
|
|
369
|
+
updated_at_le: typing.Optional[dt.datetime] = None,
|
|
370
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
371
|
+
) -> typing.List[ToolsListResponseItem]:
|
|
372
|
+
"""
|
|
373
|
+
Parameters
|
|
374
|
+
----------
|
|
375
|
+
limit : typing.Optional[float]
|
|
376
|
+
This is the maximum number of items to return. Defaults to 100.
|
|
377
|
+
|
|
378
|
+
created_at_gt : typing.Optional[dt.datetime]
|
|
379
|
+
This will return items where the createdAt is greater than the specified value.
|
|
380
|
+
|
|
381
|
+
created_at_lt : typing.Optional[dt.datetime]
|
|
382
|
+
This will return items where the createdAt is less than the specified value.
|
|
383
|
+
|
|
384
|
+
created_at_ge : typing.Optional[dt.datetime]
|
|
385
|
+
This will return items where the createdAt is greater than or equal to the specified value.
|
|
386
|
+
|
|
387
|
+
created_at_le : typing.Optional[dt.datetime]
|
|
388
|
+
This will return items where the createdAt is less than or equal to the specified value.
|
|
389
|
+
|
|
390
|
+
updated_at_gt : typing.Optional[dt.datetime]
|
|
391
|
+
This will return items where the updatedAt is greater than the specified value.
|
|
392
|
+
|
|
393
|
+
updated_at_lt : typing.Optional[dt.datetime]
|
|
394
|
+
This will return items where the updatedAt is less than the specified value.
|
|
395
|
+
|
|
396
|
+
updated_at_ge : typing.Optional[dt.datetime]
|
|
397
|
+
This will return items where the updatedAt is greater than or equal to the specified value.
|
|
398
|
+
|
|
399
|
+
updated_at_le : typing.Optional[dt.datetime]
|
|
400
|
+
This will return items where the updatedAt is less than or equal to the specified value.
|
|
401
|
+
|
|
402
|
+
request_options : typing.Optional[RequestOptions]
|
|
403
|
+
Request-specific configuration.
|
|
404
|
+
|
|
405
|
+
Returns
|
|
406
|
+
-------
|
|
407
|
+
typing.List[ToolsListResponseItem]
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
Examples
|
|
411
|
+
--------
|
|
412
|
+
import asyncio
|
|
413
|
+
|
|
414
|
+
from vapi import AsyncVapi
|
|
415
|
+
|
|
416
|
+
client = AsyncVapi(
|
|
417
|
+
token="YOUR_TOKEN",
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
async def main() -> None:
|
|
422
|
+
await client.tools.list()
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
asyncio.run(main())
|
|
426
|
+
"""
|
|
427
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
428
|
+
"tool",
|
|
429
|
+
method="GET",
|
|
430
|
+
params={
|
|
431
|
+
"limit": limit,
|
|
432
|
+
"createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
|
|
433
|
+
"createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
|
|
434
|
+
"createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
|
|
435
|
+
"createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
|
|
436
|
+
"updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
|
|
437
|
+
"updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
|
|
438
|
+
"updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
|
|
439
|
+
"updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
|
|
440
|
+
},
|
|
441
|
+
request_options=request_options,
|
|
442
|
+
)
|
|
443
|
+
try:
|
|
444
|
+
if 200 <= _response.status_code < 300:
|
|
445
|
+
return typing.cast(
|
|
446
|
+
typing.List[ToolsListResponseItem],
|
|
447
|
+
parse_obj_as(
|
|
448
|
+
type_=typing.List[ToolsListResponseItem], # type: ignore
|
|
449
|
+
object_=_response.json(),
|
|
450
|
+
),
|
|
451
|
+
)
|
|
452
|
+
_response_json = _response.json()
|
|
453
|
+
except JSONDecodeError:
|
|
454
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
455
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
456
|
+
|
|
457
|
+
async def create(
|
|
458
|
+
self, *, request: ToolsCreateRequest, request_options: typing.Optional[RequestOptions] = None
|
|
459
|
+
) -> ToolsCreateResponse:
|
|
460
|
+
"""
|
|
461
|
+
Parameters
|
|
462
|
+
----------
|
|
463
|
+
request : ToolsCreateRequest
|
|
464
|
+
|
|
465
|
+
request_options : typing.Optional[RequestOptions]
|
|
466
|
+
Request-specific configuration.
|
|
467
|
+
|
|
468
|
+
Returns
|
|
469
|
+
-------
|
|
470
|
+
ToolsCreateResponse
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
Examples
|
|
474
|
+
--------
|
|
475
|
+
import asyncio
|
|
476
|
+
|
|
477
|
+
from vapi import AsyncVapi, CreateDtmfToolDto
|
|
478
|
+
|
|
479
|
+
client = AsyncVapi(
|
|
480
|
+
token="YOUR_TOKEN",
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
async def main() -> None:
|
|
485
|
+
await client.tools.create(
|
|
486
|
+
request=CreateDtmfToolDto(),
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
asyncio.run(main())
|
|
491
|
+
"""
|
|
492
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
493
|
+
"tool",
|
|
494
|
+
method="POST",
|
|
495
|
+
json=convert_and_respect_annotation_metadata(
|
|
496
|
+
object_=request, annotation=ToolsCreateRequest, direction="write"
|
|
497
|
+
),
|
|
498
|
+
request_options=request_options,
|
|
499
|
+
omit=OMIT,
|
|
500
|
+
)
|
|
501
|
+
try:
|
|
502
|
+
if 200 <= _response.status_code < 300:
|
|
503
|
+
return typing.cast(
|
|
504
|
+
ToolsCreateResponse,
|
|
505
|
+
parse_obj_as(
|
|
506
|
+
type_=ToolsCreateResponse, # type: ignore
|
|
507
|
+
object_=_response.json(),
|
|
508
|
+
),
|
|
509
|
+
)
|
|
510
|
+
_response_json = _response.json()
|
|
511
|
+
except JSONDecodeError:
|
|
512
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
513
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
514
|
+
|
|
515
|
+
async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsGetResponse:
|
|
516
|
+
"""
|
|
517
|
+
Parameters
|
|
518
|
+
----------
|
|
519
|
+
id : str
|
|
520
|
+
|
|
521
|
+
request_options : typing.Optional[RequestOptions]
|
|
522
|
+
Request-specific configuration.
|
|
523
|
+
|
|
524
|
+
Returns
|
|
525
|
+
-------
|
|
526
|
+
ToolsGetResponse
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
Examples
|
|
530
|
+
--------
|
|
531
|
+
import asyncio
|
|
532
|
+
|
|
533
|
+
from vapi import AsyncVapi
|
|
534
|
+
|
|
535
|
+
client = AsyncVapi(
|
|
536
|
+
token="YOUR_TOKEN",
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
async def main() -> None:
|
|
541
|
+
await client.tools.get(
|
|
542
|
+
id="id",
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
asyncio.run(main())
|
|
547
|
+
"""
|
|
548
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
549
|
+
f"tool/{jsonable_encoder(id)}",
|
|
550
|
+
method="GET",
|
|
551
|
+
request_options=request_options,
|
|
552
|
+
)
|
|
553
|
+
try:
|
|
554
|
+
if 200 <= _response.status_code < 300:
|
|
555
|
+
return typing.cast(
|
|
556
|
+
ToolsGetResponse,
|
|
557
|
+
parse_obj_as(
|
|
558
|
+
type_=ToolsGetResponse, # type: ignore
|
|
559
|
+
object_=_response.json(),
|
|
560
|
+
),
|
|
561
|
+
)
|
|
562
|
+
_response_json = _response.json()
|
|
563
|
+
except JSONDecodeError:
|
|
564
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
565
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
566
|
+
|
|
567
|
+
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsDeleteResponse:
|
|
568
|
+
"""
|
|
569
|
+
Parameters
|
|
570
|
+
----------
|
|
571
|
+
id : str
|
|
572
|
+
|
|
573
|
+
request_options : typing.Optional[RequestOptions]
|
|
574
|
+
Request-specific configuration.
|
|
575
|
+
|
|
576
|
+
Returns
|
|
577
|
+
-------
|
|
578
|
+
ToolsDeleteResponse
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
Examples
|
|
582
|
+
--------
|
|
583
|
+
import asyncio
|
|
584
|
+
|
|
585
|
+
from vapi import AsyncVapi
|
|
586
|
+
|
|
587
|
+
client = AsyncVapi(
|
|
588
|
+
token="YOUR_TOKEN",
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
async def main() -> None:
|
|
593
|
+
await client.tools.delete(
|
|
594
|
+
id="id",
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
asyncio.run(main())
|
|
599
|
+
"""
|
|
600
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
601
|
+
f"tool/{jsonable_encoder(id)}",
|
|
602
|
+
method="DELETE",
|
|
603
|
+
request_options=request_options,
|
|
604
|
+
)
|
|
605
|
+
try:
|
|
606
|
+
if 200 <= _response.status_code < 300:
|
|
607
|
+
return typing.cast(
|
|
608
|
+
ToolsDeleteResponse,
|
|
609
|
+
parse_obj_as(
|
|
610
|
+
type_=ToolsDeleteResponse, # type: ignore
|
|
611
|
+
object_=_response.json(),
|
|
612
|
+
),
|
|
613
|
+
)
|
|
614
|
+
_response_json = _response.json()
|
|
615
|
+
except JSONDecodeError:
|
|
616
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
617
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
618
|
+
|
|
619
|
+
async def update(
|
|
620
|
+
self,
|
|
621
|
+
id: str,
|
|
622
|
+
*,
|
|
623
|
+
async_: typing.Optional[bool] = OMIT,
|
|
624
|
+
messages: typing.Optional[typing.Sequence[UpdateToolDtoMessagesItem]] = OMIT,
|
|
625
|
+
function: typing.Optional[OpenAiFunction] = OMIT,
|
|
626
|
+
server: typing.Optional[Server] = OMIT,
|
|
627
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
628
|
+
) -> ToolsUpdateResponse:
|
|
629
|
+
"""
|
|
630
|
+
Parameters
|
|
631
|
+
----------
|
|
632
|
+
id : str
|
|
633
|
+
|
|
634
|
+
async_ : typing.Optional[bool]
|
|
635
|
+
This determines if the tool is async.
|
|
636
|
+
|
|
637
|
+
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.
|
|
638
|
+
|
|
639
|
+
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.
|
|
640
|
+
|
|
641
|
+
Defaults to synchronous (`false`).
|
|
642
|
+
|
|
643
|
+
messages : typing.Optional[typing.Sequence[UpdateToolDtoMessagesItem]]
|
|
644
|
+
These are the messages that will be spoken to the user as the tool is running.
|
|
645
|
+
|
|
646
|
+
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.
|
|
647
|
+
|
|
648
|
+
function : typing.Optional[OpenAiFunction]
|
|
649
|
+
This is the function definition of the tool.
|
|
650
|
+
|
|
651
|
+
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.
|
|
652
|
+
|
|
653
|
+
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.
|
|
654
|
+
|
|
655
|
+
server : typing.Optional[Server]
|
|
656
|
+
This is the server that will be hit when this tool is requested by the model.
|
|
657
|
+
|
|
658
|
+
All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
|
|
659
|
+
|
|
660
|
+
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.
|
|
661
|
+
|
|
662
|
+
request_options : typing.Optional[RequestOptions]
|
|
663
|
+
Request-specific configuration.
|
|
664
|
+
|
|
665
|
+
Returns
|
|
666
|
+
-------
|
|
667
|
+
ToolsUpdateResponse
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
Examples
|
|
671
|
+
--------
|
|
672
|
+
import asyncio
|
|
673
|
+
|
|
674
|
+
from vapi import AsyncVapi
|
|
675
|
+
|
|
676
|
+
client = AsyncVapi(
|
|
677
|
+
token="YOUR_TOKEN",
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
async def main() -> None:
|
|
682
|
+
await client.tools.update(
|
|
683
|
+
id="id",
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
asyncio.run(main())
|
|
688
|
+
"""
|
|
689
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
690
|
+
f"tool/{jsonable_encoder(id)}",
|
|
691
|
+
method="PATCH",
|
|
692
|
+
json={
|
|
693
|
+
"async": async_,
|
|
694
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
695
|
+
object_=messages, annotation=typing.Sequence[UpdateToolDtoMessagesItem], direction="write"
|
|
696
|
+
),
|
|
697
|
+
"function": convert_and_respect_annotation_metadata(
|
|
698
|
+
object_=function, annotation=OpenAiFunction, direction="write"
|
|
699
|
+
),
|
|
700
|
+
"server": convert_and_respect_annotation_metadata(object_=server, annotation=Server, direction="write"),
|
|
701
|
+
},
|
|
702
|
+
request_options=request_options,
|
|
703
|
+
omit=OMIT,
|
|
704
|
+
)
|
|
705
|
+
try:
|
|
706
|
+
if 200 <= _response.status_code < 300:
|
|
707
|
+
return typing.cast(
|
|
708
|
+
ToolsUpdateResponse,
|
|
709
|
+
parse_obj_as(
|
|
710
|
+
type_=ToolsUpdateResponse, # type: ignore
|
|
711
|
+
object_=_response.json(),
|
|
712
|
+
),
|
|
713
|
+
)
|
|
714
|
+
_response_json = _response.json()
|
|
715
|
+
except JSONDecodeError:
|
|
716
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
717
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|