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/blocks/client.py
ADDED
|
@@ -0,0 +1,804 @@
|
|
|
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.blocks_list_response_item import BlocksListResponseItem
|
|
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.blocks_create_request import BlocksCreateRequest
|
|
13
|
+
from .types.blocks_create_response import BlocksCreateResponse
|
|
14
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
15
|
+
from .types.blocks_get_response import BlocksGetResponse
|
|
16
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
17
|
+
from .types.blocks_delete_response import BlocksDeleteResponse
|
|
18
|
+
from .types.update_block_dto_messages_item import UpdateBlockDtoMessagesItem
|
|
19
|
+
from ..types.json_schema import JsonSchema
|
|
20
|
+
from .types.update_block_dto_tool import UpdateBlockDtoTool
|
|
21
|
+
from .types.update_block_dto_steps_item import UpdateBlockDtoStepsItem
|
|
22
|
+
from .types.blocks_update_response import BlocksUpdateResponse
|
|
23
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
24
|
+
|
|
25
|
+
# this is used as the default value for optional parameters
|
|
26
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class BlocksClient:
|
|
30
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
31
|
+
self._client_wrapper = client_wrapper
|
|
32
|
+
|
|
33
|
+
def list(
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
limit: typing.Optional[float] = None,
|
|
37
|
+
created_at_gt: typing.Optional[dt.datetime] = None,
|
|
38
|
+
created_at_lt: typing.Optional[dt.datetime] = None,
|
|
39
|
+
created_at_ge: typing.Optional[dt.datetime] = None,
|
|
40
|
+
created_at_le: typing.Optional[dt.datetime] = None,
|
|
41
|
+
updated_at_gt: typing.Optional[dt.datetime] = None,
|
|
42
|
+
updated_at_lt: typing.Optional[dt.datetime] = None,
|
|
43
|
+
updated_at_ge: typing.Optional[dt.datetime] = None,
|
|
44
|
+
updated_at_le: typing.Optional[dt.datetime] = None,
|
|
45
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
46
|
+
) -> typing.List[BlocksListResponseItem]:
|
|
47
|
+
"""
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
limit : typing.Optional[float]
|
|
51
|
+
This is the maximum number of items to return. Defaults to 100.
|
|
52
|
+
|
|
53
|
+
created_at_gt : typing.Optional[dt.datetime]
|
|
54
|
+
This will return items where the createdAt is greater than the specified value.
|
|
55
|
+
|
|
56
|
+
created_at_lt : typing.Optional[dt.datetime]
|
|
57
|
+
This will return items where the createdAt is less than the specified value.
|
|
58
|
+
|
|
59
|
+
created_at_ge : typing.Optional[dt.datetime]
|
|
60
|
+
This will return items where the createdAt is greater than or equal to the specified value.
|
|
61
|
+
|
|
62
|
+
created_at_le : typing.Optional[dt.datetime]
|
|
63
|
+
This will return items where the createdAt is less than or equal to the specified value.
|
|
64
|
+
|
|
65
|
+
updated_at_gt : typing.Optional[dt.datetime]
|
|
66
|
+
This will return items where the updatedAt is greater than the specified value.
|
|
67
|
+
|
|
68
|
+
updated_at_lt : typing.Optional[dt.datetime]
|
|
69
|
+
This will return items where the updatedAt is less than the specified value.
|
|
70
|
+
|
|
71
|
+
updated_at_ge : typing.Optional[dt.datetime]
|
|
72
|
+
This will return items where the updatedAt is greater than or equal to the specified value.
|
|
73
|
+
|
|
74
|
+
updated_at_le : typing.Optional[dt.datetime]
|
|
75
|
+
This will return items where the updatedAt is less than or equal to the specified value.
|
|
76
|
+
|
|
77
|
+
request_options : typing.Optional[RequestOptions]
|
|
78
|
+
Request-specific configuration.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
typing.List[BlocksListResponseItem]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
Examples
|
|
86
|
+
--------
|
|
87
|
+
from vapi import Vapi
|
|
88
|
+
|
|
89
|
+
client = Vapi(
|
|
90
|
+
token="YOUR_TOKEN",
|
|
91
|
+
)
|
|
92
|
+
client.blocks.list()
|
|
93
|
+
"""
|
|
94
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
95
|
+
"block",
|
|
96
|
+
method="GET",
|
|
97
|
+
params={
|
|
98
|
+
"limit": limit,
|
|
99
|
+
"createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
|
|
100
|
+
"createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
|
|
101
|
+
"createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
|
|
102
|
+
"createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
|
|
103
|
+
"updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
|
|
104
|
+
"updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
|
|
105
|
+
"updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
|
|
106
|
+
"updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
|
|
107
|
+
},
|
|
108
|
+
request_options=request_options,
|
|
109
|
+
)
|
|
110
|
+
try:
|
|
111
|
+
if 200 <= _response.status_code < 300:
|
|
112
|
+
return typing.cast(
|
|
113
|
+
typing.List[BlocksListResponseItem],
|
|
114
|
+
parse_obj_as(
|
|
115
|
+
type_=typing.List[BlocksListResponseItem], # type: ignore
|
|
116
|
+
object_=_response.json(),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
_response_json = _response.json()
|
|
120
|
+
except JSONDecodeError:
|
|
121
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
122
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
123
|
+
|
|
124
|
+
def create(
|
|
125
|
+
self, *, request: BlocksCreateRequest, request_options: typing.Optional[RequestOptions] = None
|
|
126
|
+
) -> BlocksCreateResponse:
|
|
127
|
+
"""
|
|
128
|
+
Parameters
|
|
129
|
+
----------
|
|
130
|
+
request : BlocksCreateRequest
|
|
131
|
+
|
|
132
|
+
request_options : typing.Optional[RequestOptions]
|
|
133
|
+
Request-specific configuration.
|
|
134
|
+
|
|
135
|
+
Returns
|
|
136
|
+
-------
|
|
137
|
+
BlocksCreateResponse
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
Examples
|
|
141
|
+
--------
|
|
142
|
+
from vapi import CreateConversationBlockDto, Vapi
|
|
143
|
+
|
|
144
|
+
client = Vapi(
|
|
145
|
+
token="YOUR_TOKEN",
|
|
146
|
+
)
|
|
147
|
+
client.blocks.create(
|
|
148
|
+
request=CreateConversationBlockDto(
|
|
149
|
+
instruction="instruction",
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
"""
|
|
153
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
154
|
+
"block",
|
|
155
|
+
method="POST",
|
|
156
|
+
json=convert_and_respect_annotation_metadata(
|
|
157
|
+
object_=request, annotation=BlocksCreateRequest, direction="write"
|
|
158
|
+
),
|
|
159
|
+
request_options=request_options,
|
|
160
|
+
omit=OMIT,
|
|
161
|
+
)
|
|
162
|
+
try:
|
|
163
|
+
if 200 <= _response.status_code < 300:
|
|
164
|
+
return typing.cast(
|
|
165
|
+
BlocksCreateResponse,
|
|
166
|
+
parse_obj_as(
|
|
167
|
+
type_=BlocksCreateResponse, # type: ignore
|
|
168
|
+
object_=_response.json(),
|
|
169
|
+
),
|
|
170
|
+
)
|
|
171
|
+
_response_json = _response.json()
|
|
172
|
+
except JSONDecodeError:
|
|
173
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
174
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
175
|
+
|
|
176
|
+
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BlocksGetResponse:
|
|
177
|
+
"""
|
|
178
|
+
Parameters
|
|
179
|
+
----------
|
|
180
|
+
id : str
|
|
181
|
+
|
|
182
|
+
request_options : typing.Optional[RequestOptions]
|
|
183
|
+
Request-specific configuration.
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
BlocksGetResponse
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
Examples
|
|
191
|
+
--------
|
|
192
|
+
from vapi import Vapi
|
|
193
|
+
|
|
194
|
+
client = Vapi(
|
|
195
|
+
token="YOUR_TOKEN",
|
|
196
|
+
)
|
|
197
|
+
client.blocks.get(
|
|
198
|
+
id="id",
|
|
199
|
+
)
|
|
200
|
+
"""
|
|
201
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
202
|
+
f"block/{jsonable_encoder(id)}",
|
|
203
|
+
method="GET",
|
|
204
|
+
request_options=request_options,
|
|
205
|
+
)
|
|
206
|
+
try:
|
|
207
|
+
if 200 <= _response.status_code < 300:
|
|
208
|
+
return typing.cast(
|
|
209
|
+
BlocksGetResponse,
|
|
210
|
+
parse_obj_as(
|
|
211
|
+
type_=BlocksGetResponse, # type: ignore
|
|
212
|
+
object_=_response.json(),
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
_response_json = _response.json()
|
|
216
|
+
except JSONDecodeError:
|
|
217
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
218
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
219
|
+
|
|
220
|
+
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BlocksDeleteResponse:
|
|
221
|
+
"""
|
|
222
|
+
Parameters
|
|
223
|
+
----------
|
|
224
|
+
id : str
|
|
225
|
+
|
|
226
|
+
request_options : typing.Optional[RequestOptions]
|
|
227
|
+
Request-specific configuration.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
BlocksDeleteResponse
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
Examples
|
|
235
|
+
--------
|
|
236
|
+
from vapi import Vapi
|
|
237
|
+
|
|
238
|
+
client = Vapi(
|
|
239
|
+
token="YOUR_TOKEN",
|
|
240
|
+
)
|
|
241
|
+
client.blocks.delete(
|
|
242
|
+
id="id",
|
|
243
|
+
)
|
|
244
|
+
"""
|
|
245
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
246
|
+
f"block/{jsonable_encoder(id)}",
|
|
247
|
+
method="DELETE",
|
|
248
|
+
request_options=request_options,
|
|
249
|
+
)
|
|
250
|
+
try:
|
|
251
|
+
if 200 <= _response.status_code < 300:
|
|
252
|
+
return typing.cast(
|
|
253
|
+
BlocksDeleteResponse,
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=BlocksDeleteResponse, # type: ignore
|
|
256
|
+
object_=_response.json(),
|
|
257
|
+
),
|
|
258
|
+
)
|
|
259
|
+
_response_json = _response.json()
|
|
260
|
+
except JSONDecodeError:
|
|
261
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
262
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
263
|
+
|
|
264
|
+
def update(
|
|
265
|
+
self,
|
|
266
|
+
id: str,
|
|
267
|
+
*,
|
|
268
|
+
messages: typing.Optional[typing.Sequence[UpdateBlockDtoMessagesItem]] = OMIT,
|
|
269
|
+
input_schema: typing.Optional[JsonSchema] = OMIT,
|
|
270
|
+
output_schema: typing.Optional[JsonSchema] = OMIT,
|
|
271
|
+
tool: typing.Optional[UpdateBlockDtoTool] = OMIT,
|
|
272
|
+
steps: typing.Optional[typing.Sequence[UpdateBlockDtoStepsItem]] = OMIT,
|
|
273
|
+
name: typing.Optional[str] = OMIT,
|
|
274
|
+
instruction: typing.Optional[str] = OMIT,
|
|
275
|
+
tool_id: typing.Optional[str] = OMIT,
|
|
276
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
277
|
+
) -> BlocksUpdateResponse:
|
|
278
|
+
"""
|
|
279
|
+
Parameters
|
|
280
|
+
----------
|
|
281
|
+
id : str
|
|
282
|
+
|
|
283
|
+
messages : typing.Optional[typing.Sequence[UpdateBlockDtoMessagesItem]]
|
|
284
|
+
These are the pre-configured messages that will be spoken to the user while the block is running.
|
|
285
|
+
|
|
286
|
+
input_schema : typing.Optional[JsonSchema]
|
|
287
|
+
This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input`
|
|
288
|
+
|
|
289
|
+
These are accessible as variables:
|
|
290
|
+
- ({{input.propertyName}}) in context of the block execution (step)
|
|
291
|
+
- ({{stepName.input.propertyName}}) in context of the workflow
|
|
292
|
+
|
|
293
|
+
output_schema : typing.Optional[JsonSchema]
|
|
294
|
+
This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`).
|
|
295
|
+
|
|
296
|
+
These are accessible as variables:
|
|
297
|
+
- ({{output.propertyName}}) in context of the block execution (step)
|
|
298
|
+
- ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
|
299
|
+
- ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
|
|
300
|
+
|
|
301
|
+
Caveats:
|
|
302
|
+
1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
|
|
303
|
+
2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
|
|
304
|
+
|
|
305
|
+
tool : typing.Optional[UpdateBlockDtoTool]
|
|
306
|
+
This is the tool that the block will call. To use an existing tool, use `toolId`.
|
|
307
|
+
|
|
308
|
+
steps : typing.Optional[typing.Sequence[UpdateBlockDtoStepsItem]]
|
|
309
|
+
These are the steps in the workflow.
|
|
310
|
+
|
|
311
|
+
name : typing.Optional[str]
|
|
312
|
+
This is the name of the block. This is just for your reference.
|
|
313
|
+
|
|
314
|
+
instruction : typing.Optional[str]
|
|
315
|
+
This is the instruction to the model.
|
|
316
|
+
|
|
317
|
+
You can reference any variable in the context of the current block execution (step):
|
|
318
|
+
- "{{input.your-property-name}}" for the current step's input
|
|
319
|
+
- "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
|
|
320
|
+
- "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
|
|
321
|
+
- "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
|
|
322
|
+
- "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
|
|
323
|
+
- "{{workflow.input.your-property-name}}" for the current workflow's input
|
|
324
|
+
- "{{global.your-property-name}}" for the global context
|
|
325
|
+
|
|
326
|
+
This can be as simple or as complex as you want it to be.
|
|
327
|
+
- "say hello and ask the user about their day!"
|
|
328
|
+
- "collect the user's first and last name"
|
|
329
|
+
- "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
|
|
330
|
+
|
|
331
|
+
Caveats:
|
|
332
|
+
1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
|
|
333
|
+
2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
|
|
334
|
+
|
|
335
|
+
tool_id : typing.Optional[str]
|
|
336
|
+
This is the id of the tool that the block will call. To use a transient tool, use `tool`.
|
|
337
|
+
|
|
338
|
+
request_options : typing.Optional[RequestOptions]
|
|
339
|
+
Request-specific configuration.
|
|
340
|
+
|
|
341
|
+
Returns
|
|
342
|
+
-------
|
|
343
|
+
BlocksUpdateResponse
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
Examples
|
|
347
|
+
--------
|
|
348
|
+
from vapi import Vapi
|
|
349
|
+
|
|
350
|
+
client = Vapi(
|
|
351
|
+
token="YOUR_TOKEN",
|
|
352
|
+
)
|
|
353
|
+
client.blocks.update(
|
|
354
|
+
id="id",
|
|
355
|
+
)
|
|
356
|
+
"""
|
|
357
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
358
|
+
f"block/{jsonable_encoder(id)}",
|
|
359
|
+
method="PATCH",
|
|
360
|
+
json={
|
|
361
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
362
|
+
object_=messages, annotation=typing.Sequence[UpdateBlockDtoMessagesItem], direction="write"
|
|
363
|
+
),
|
|
364
|
+
"inputSchema": convert_and_respect_annotation_metadata(
|
|
365
|
+
object_=input_schema, annotation=JsonSchema, direction="write"
|
|
366
|
+
),
|
|
367
|
+
"outputSchema": convert_and_respect_annotation_metadata(
|
|
368
|
+
object_=output_schema, annotation=JsonSchema, direction="write"
|
|
369
|
+
),
|
|
370
|
+
"tool": convert_and_respect_annotation_metadata(
|
|
371
|
+
object_=tool, annotation=UpdateBlockDtoTool, direction="write"
|
|
372
|
+
),
|
|
373
|
+
"steps": convert_and_respect_annotation_metadata(
|
|
374
|
+
object_=steps, annotation=typing.Sequence[UpdateBlockDtoStepsItem], direction="write"
|
|
375
|
+
),
|
|
376
|
+
"name": name,
|
|
377
|
+
"instruction": instruction,
|
|
378
|
+
"toolId": tool_id,
|
|
379
|
+
},
|
|
380
|
+
request_options=request_options,
|
|
381
|
+
omit=OMIT,
|
|
382
|
+
)
|
|
383
|
+
try:
|
|
384
|
+
if 200 <= _response.status_code < 300:
|
|
385
|
+
return typing.cast(
|
|
386
|
+
BlocksUpdateResponse,
|
|
387
|
+
parse_obj_as(
|
|
388
|
+
type_=BlocksUpdateResponse, # type: ignore
|
|
389
|
+
object_=_response.json(),
|
|
390
|
+
),
|
|
391
|
+
)
|
|
392
|
+
_response_json = _response.json()
|
|
393
|
+
except JSONDecodeError:
|
|
394
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
395
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class AsyncBlocksClient:
|
|
399
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
400
|
+
self._client_wrapper = client_wrapper
|
|
401
|
+
|
|
402
|
+
async def list(
|
|
403
|
+
self,
|
|
404
|
+
*,
|
|
405
|
+
limit: typing.Optional[float] = None,
|
|
406
|
+
created_at_gt: typing.Optional[dt.datetime] = None,
|
|
407
|
+
created_at_lt: typing.Optional[dt.datetime] = None,
|
|
408
|
+
created_at_ge: typing.Optional[dt.datetime] = None,
|
|
409
|
+
created_at_le: typing.Optional[dt.datetime] = None,
|
|
410
|
+
updated_at_gt: typing.Optional[dt.datetime] = None,
|
|
411
|
+
updated_at_lt: typing.Optional[dt.datetime] = None,
|
|
412
|
+
updated_at_ge: typing.Optional[dt.datetime] = None,
|
|
413
|
+
updated_at_le: typing.Optional[dt.datetime] = None,
|
|
414
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
415
|
+
) -> typing.List[BlocksListResponseItem]:
|
|
416
|
+
"""
|
|
417
|
+
Parameters
|
|
418
|
+
----------
|
|
419
|
+
limit : typing.Optional[float]
|
|
420
|
+
This is the maximum number of items to return. Defaults to 100.
|
|
421
|
+
|
|
422
|
+
created_at_gt : typing.Optional[dt.datetime]
|
|
423
|
+
This will return items where the createdAt is greater than the specified value.
|
|
424
|
+
|
|
425
|
+
created_at_lt : typing.Optional[dt.datetime]
|
|
426
|
+
This will return items where the createdAt is less than the specified value.
|
|
427
|
+
|
|
428
|
+
created_at_ge : typing.Optional[dt.datetime]
|
|
429
|
+
This will return items where the createdAt is greater than or equal to the specified value.
|
|
430
|
+
|
|
431
|
+
created_at_le : typing.Optional[dt.datetime]
|
|
432
|
+
This will return items where the createdAt is less than or equal to the specified value.
|
|
433
|
+
|
|
434
|
+
updated_at_gt : typing.Optional[dt.datetime]
|
|
435
|
+
This will return items where the updatedAt is greater than the specified value.
|
|
436
|
+
|
|
437
|
+
updated_at_lt : typing.Optional[dt.datetime]
|
|
438
|
+
This will return items where the updatedAt is less than the specified value.
|
|
439
|
+
|
|
440
|
+
updated_at_ge : typing.Optional[dt.datetime]
|
|
441
|
+
This will return items where the updatedAt is greater than or equal to the specified value.
|
|
442
|
+
|
|
443
|
+
updated_at_le : typing.Optional[dt.datetime]
|
|
444
|
+
This will return items where the updatedAt is less than or equal to the specified value.
|
|
445
|
+
|
|
446
|
+
request_options : typing.Optional[RequestOptions]
|
|
447
|
+
Request-specific configuration.
|
|
448
|
+
|
|
449
|
+
Returns
|
|
450
|
+
-------
|
|
451
|
+
typing.List[BlocksListResponseItem]
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
Examples
|
|
455
|
+
--------
|
|
456
|
+
import asyncio
|
|
457
|
+
|
|
458
|
+
from vapi import AsyncVapi
|
|
459
|
+
|
|
460
|
+
client = AsyncVapi(
|
|
461
|
+
token="YOUR_TOKEN",
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
async def main() -> None:
|
|
466
|
+
await client.blocks.list()
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
asyncio.run(main())
|
|
470
|
+
"""
|
|
471
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
472
|
+
"block",
|
|
473
|
+
method="GET",
|
|
474
|
+
params={
|
|
475
|
+
"limit": limit,
|
|
476
|
+
"createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
|
|
477
|
+
"createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
|
|
478
|
+
"createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
|
|
479
|
+
"createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
|
|
480
|
+
"updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
|
|
481
|
+
"updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
|
|
482
|
+
"updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
|
|
483
|
+
"updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
|
|
484
|
+
},
|
|
485
|
+
request_options=request_options,
|
|
486
|
+
)
|
|
487
|
+
try:
|
|
488
|
+
if 200 <= _response.status_code < 300:
|
|
489
|
+
return typing.cast(
|
|
490
|
+
typing.List[BlocksListResponseItem],
|
|
491
|
+
parse_obj_as(
|
|
492
|
+
type_=typing.List[BlocksListResponseItem], # type: ignore
|
|
493
|
+
object_=_response.json(),
|
|
494
|
+
),
|
|
495
|
+
)
|
|
496
|
+
_response_json = _response.json()
|
|
497
|
+
except JSONDecodeError:
|
|
498
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
499
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
500
|
+
|
|
501
|
+
async def create(
|
|
502
|
+
self, *, request: BlocksCreateRequest, request_options: typing.Optional[RequestOptions] = None
|
|
503
|
+
) -> BlocksCreateResponse:
|
|
504
|
+
"""
|
|
505
|
+
Parameters
|
|
506
|
+
----------
|
|
507
|
+
request : BlocksCreateRequest
|
|
508
|
+
|
|
509
|
+
request_options : typing.Optional[RequestOptions]
|
|
510
|
+
Request-specific configuration.
|
|
511
|
+
|
|
512
|
+
Returns
|
|
513
|
+
-------
|
|
514
|
+
BlocksCreateResponse
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
Examples
|
|
518
|
+
--------
|
|
519
|
+
import asyncio
|
|
520
|
+
|
|
521
|
+
from vapi import AsyncVapi, CreateConversationBlockDto
|
|
522
|
+
|
|
523
|
+
client = AsyncVapi(
|
|
524
|
+
token="YOUR_TOKEN",
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
async def main() -> None:
|
|
529
|
+
await client.blocks.create(
|
|
530
|
+
request=CreateConversationBlockDto(
|
|
531
|
+
instruction="instruction",
|
|
532
|
+
),
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
asyncio.run(main())
|
|
537
|
+
"""
|
|
538
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
539
|
+
"block",
|
|
540
|
+
method="POST",
|
|
541
|
+
json=convert_and_respect_annotation_metadata(
|
|
542
|
+
object_=request, annotation=BlocksCreateRequest, direction="write"
|
|
543
|
+
),
|
|
544
|
+
request_options=request_options,
|
|
545
|
+
omit=OMIT,
|
|
546
|
+
)
|
|
547
|
+
try:
|
|
548
|
+
if 200 <= _response.status_code < 300:
|
|
549
|
+
return typing.cast(
|
|
550
|
+
BlocksCreateResponse,
|
|
551
|
+
parse_obj_as(
|
|
552
|
+
type_=BlocksCreateResponse, # type: ignore
|
|
553
|
+
object_=_response.json(),
|
|
554
|
+
),
|
|
555
|
+
)
|
|
556
|
+
_response_json = _response.json()
|
|
557
|
+
except JSONDecodeError:
|
|
558
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
559
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
560
|
+
|
|
561
|
+
async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BlocksGetResponse:
|
|
562
|
+
"""
|
|
563
|
+
Parameters
|
|
564
|
+
----------
|
|
565
|
+
id : str
|
|
566
|
+
|
|
567
|
+
request_options : typing.Optional[RequestOptions]
|
|
568
|
+
Request-specific configuration.
|
|
569
|
+
|
|
570
|
+
Returns
|
|
571
|
+
-------
|
|
572
|
+
BlocksGetResponse
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
Examples
|
|
576
|
+
--------
|
|
577
|
+
import asyncio
|
|
578
|
+
|
|
579
|
+
from vapi import AsyncVapi
|
|
580
|
+
|
|
581
|
+
client = AsyncVapi(
|
|
582
|
+
token="YOUR_TOKEN",
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
async def main() -> None:
|
|
587
|
+
await client.blocks.get(
|
|
588
|
+
id="id",
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
asyncio.run(main())
|
|
593
|
+
"""
|
|
594
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
595
|
+
f"block/{jsonable_encoder(id)}",
|
|
596
|
+
method="GET",
|
|
597
|
+
request_options=request_options,
|
|
598
|
+
)
|
|
599
|
+
try:
|
|
600
|
+
if 200 <= _response.status_code < 300:
|
|
601
|
+
return typing.cast(
|
|
602
|
+
BlocksGetResponse,
|
|
603
|
+
parse_obj_as(
|
|
604
|
+
type_=BlocksGetResponse, # type: ignore
|
|
605
|
+
object_=_response.json(),
|
|
606
|
+
),
|
|
607
|
+
)
|
|
608
|
+
_response_json = _response.json()
|
|
609
|
+
except JSONDecodeError:
|
|
610
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
611
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
612
|
+
|
|
613
|
+
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BlocksDeleteResponse:
|
|
614
|
+
"""
|
|
615
|
+
Parameters
|
|
616
|
+
----------
|
|
617
|
+
id : str
|
|
618
|
+
|
|
619
|
+
request_options : typing.Optional[RequestOptions]
|
|
620
|
+
Request-specific configuration.
|
|
621
|
+
|
|
622
|
+
Returns
|
|
623
|
+
-------
|
|
624
|
+
BlocksDeleteResponse
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
Examples
|
|
628
|
+
--------
|
|
629
|
+
import asyncio
|
|
630
|
+
|
|
631
|
+
from vapi import AsyncVapi
|
|
632
|
+
|
|
633
|
+
client = AsyncVapi(
|
|
634
|
+
token="YOUR_TOKEN",
|
|
635
|
+
)
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
async def main() -> None:
|
|
639
|
+
await client.blocks.delete(
|
|
640
|
+
id="id",
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
asyncio.run(main())
|
|
645
|
+
"""
|
|
646
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
647
|
+
f"block/{jsonable_encoder(id)}",
|
|
648
|
+
method="DELETE",
|
|
649
|
+
request_options=request_options,
|
|
650
|
+
)
|
|
651
|
+
try:
|
|
652
|
+
if 200 <= _response.status_code < 300:
|
|
653
|
+
return typing.cast(
|
|
654
|
+
BlocksDeleteResponse,
|
|
655
|
+
parse_obj_as(
|
|
656
|
+
type_=BlocksDeleteResponse, # type: ignore
|
|
657
|
+
object_=_response.json(),
|
|
658
|
+
),
|
|
659
|
+
)
|
|
660
|
+
_response_json = _response.json()
|
|
661
|
+
except JSONDecodeError:
|
|
662
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
663
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
664
|
+
|
|
665
|
+
async def update(
|
|
666
|
+
self,
|
|
667
|
+
id: str,
|
|
668
|
+
*,
|
|
669
|
+
messages: typing.Optional[typing.Sequence[UpdateBlockDtoMessagesItem]] = OMIT,
|
|
670
|
+
input_schema: typing.Optional[JsonSchema] = OMIT,
|
|
671
|
+
output_schema: typing.Optional[JsonSchema] = OMIT,
|
|
672
|
+
tool: typing.Optional[UpdateBlockDtoTool] = OMIT,
|
|
673
|
+
steps: typing.Optional[typing.Sequence[UpdateBlockDtoStepsItem]] = OMIT,
|
|
674
|
+
name: typing.Optional[str] = OMIT,
|
|
675
|
+
instruction: typing.Optional[str] = OMIT,
|
|
676
|
+
tool_id: typing.Optional[str] = OMIT,
|
|
677
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
678
|
+
) -> BlocksUpdateResponse:
|
|
679
|
+
"""
|
|
680
|
+
Parameters
|
|
681
|
+
----------
|
|
682
|
+
id : str
|
|
683
|
+
|
|
684
|
+
messages : typing.Optional[typing.Sequence[UpdateBlockDtoMessagesItem]]
|
|
685
|
+
These are the pre-configured messages that will be spoken to the user while the block is running.
|
|
686
|
+
|
|
687
|
+
input_schema : typing.Optional[JsonSchema]
|
|
688
|
+
This is the input schema for the block. This is the input the block needs to run. It's given to the block as `steps[0].input`
|
|
689
|
+
|
|
690
|
+
These are accessible as variables:
|
|
691
|
+
- ({{input.propertyName}}) in context of the block execution (step)
|
|
692
|
+
- ({{stepName.input.propertyName}}) in context of the workflow
|
|
693
|
+
|
|
694
|
+
output_schema : typing.Optional[JsonSchema]
|
|
695
|
+
This is the output schema for the block. This is the output the block will return to the workflow (`{{stepName.output}}`).
|
|
696
|
+
|
|
697
|
+
These are accessible as variables:
|
|
698
|
+
- ({{output.propertyName}}) in context of the block execution (step)
|
|
699
|
+
- ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
|
700
|
+
- ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
|
|
701
|
+
|
|
702
|
+
Caveats:
|
|
703
|
+
1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
|
|
704
|
+
2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
|
|
705
|
+
|
|
706
|
+
tool : typing.Optional[UpdateBlockDtoTool]
|
|
707
|
+
This is the tool that the block will call. To use an existing tool, use `toolId`.
|
|
708
|
+
|
|
709
|
+
steps : typing.Optional[typing.Sequence[UpdateBlockDtoStepsItem]]
|
|
710
|
+
These are the steps in the workflow.
|
|
711
|
+
|
|
712
|
+
name : typing.Optional[str]
|
|
713
|
+
This is the name of the block. This is just for your reference.
|
|
714
|
+
|
|
715
|
+
instruction : typing.Optional[str]
|
|
716
|
+
This is the instruction to the model.
|
|
717
|
+
|
|
718
|
+
You can reference any variable in the context of the current block execution (step):
|
|
719
|
+
- "{{input.your-property-name}}" for the current step's input
|
|
720
|
+
- "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
|
|
721
|
+
- "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
|
|
722
|
+
- "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
|
|
723
|
+
- "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
|
|
724
|
+
- "{{workflow.input.your-property-name}}" for the current workflow's input
|
|
725
|
+
- "{{global.your-property-name}}" for the global context
|
|
726
|
+
|
|
727
|
+
This can be as simple or as complex as you want it to be.
|
|
728
|
+
- "say hello and ask the user about their day!"
|
|
729
|
+
- "collect the user's first and last name"
|
|
730
|
+
- "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
|
|
731
|
+
|
|
732
|
+
Caveats:
|
|
733
|
+
1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
|
|
734
|
+
2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
|
|
735
|
+
|
|
736
|
+
tool_id : typing.Optional[str]
|
|
737
|
+
This is the id of the tool that the block will call. To use a transient tool, use `tool`.
|
|
738
|
+
|
|
739
|
+
request_options : typing.Optional[RequestOptions]
|
|
740
|
+
Request-specific configuration.
|
|
741
|
+
|
|
742
|
+
Returns
|
|
743
|
+
-------
|
|
744
|
+
BlocksUpdateResponse
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
Examples
|
|
748
|
+
--------
|
|
749
|
+
import asyncio
|
|
750
|
+
|
|
751
|
+
from vapi import AsyncVapi
|
|
752
|
+
|
|
753
|
+
client = AsyncVapi(
|
|
754
|
+
token="YOUR_TOKEN",
|
|
755
|
+
)
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
async def main() -> None:
|
|
759
|
+
await client.blocks.update(
|
|
760
|
+
id="id",
|
|
761
|
+
)
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
asyncio.run(main())
|
|
765
|
+
"""
|
|
766
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
767
|
+
f"block/{jsonable_encoder(id)}",
|
|
768
|
+
method="PATCH",
|
|
769
|
+
json={
|
|
770
|
+
"messages": convert_and_respect_annotation_metadata(
|
|
771
|
+
object_=messages, annotation=typing.Sequence[UpdateBlockDtoMessagesItem], direction="write"
|
|
772
|
+
),
|
|
773
|
+
"inputSchema": convert_and_respect_annotation_metadata(
|
|
774
|
+
object_=input_schema, annotation=JsonSchema, direction="write"
|
|
775
|
+
),
|
|
776
|
+
"outputSchema": convert_and_respect_annotation_metadata(
|
|
777
|
+
object_=output_schema, annotation=JsonSchema, direction="write"
|
|
778
|
+
),
|
|
779
|
+
"tool": convert_and_respect_annotation_metadata(
|
|
780
|
+
object_=tool, annotation=UpdateBlockDtoTool, direction="write"
|
|
781
|
+
),
|
|
782
|
+
"steps": convert_and_respect_annotation_metadata(
|
|
783
|
+
object_=steps, annotation=typing.Sequence[UpdateBlockDtoStepsItem], direction="write"
|
|
784
|
+
),
|
|
785
|
+
"name": name,
|
|
786
|
+
"instruction": instruction,
|
|
787
|
+
"toolId": tool_id,
|
|
788
|
+
},
|
|
789
|
+
request_options=request_options,
|
|
790
|
+
omit=OMIT,
|
|
791
|
+
)
|
|
792
|
+
try:
|
|
793
|
+
if 200 <= _response.status_code < 300:
|
|
794
|
+
return typing.cast(
|
|
795
|
+
BlocksUpdateResponse,
|
|
796
|
+
parse_obj_as(
|
|
797
|
+
type_=BlocksUpdateResponse, # type: ignore
|
|
798
|
+
object_=_response.json(),
|
|
799
|
+
),
|
|
800
|
+
)
|
|
801
|
+
_response_json = _response.json()
|
|
802
|
+
except JSONDecodeError:
|
|
803
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
804
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|