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.
Files changed (571) hide show
  1. vapi/__init__.py +1081 -0
  2. vapi/analytics/__init__.py +2 -0
  3. vapi/analytics/client.py +159 -0
  4. vapi/assistants/__init__.py +21 -0
  5. vapi/assistants/client.py +1593 -0
  6. vapi/assistants/types/__init__.py +19 -0
  7. vapi/assistants/types/update_assistant_dto_background_sound.py +5 -0
  8. vapi/assistants/types/update_assistant_dto_client_messages_item.py +23 -0
  9. vapi/assistants/types/update_assistant_dto_first_message_mode.py +10 -0
  10. vapi/assistants/types/update_assistant_dto_model.py +26 -0
  11. vapi/assistants/types/update_assistant_dto_server_messages_item.py +24 -0
  12. vapi/assistants/types/update_assistant_dto_transcriber.py +8 -0
  13. vapi/assistants/types/update_assistant_dto_voice.py +24 -0
  14. vapi/blocks/__init__.py +25 -0
  15. vapi/blocks/client.py +804 -0
  16. vapi/blocks/types/__init__.py +23 -0
  17. vapi/blocks/types/blocks_create_request.py +8 -0
  18. vapi/blocks/types/blocks_create_response.py +8 -0
  19. vapi/blocks/types/blocks_delete_response.py +8 -0
  20. vapi/blocks/types/blocks_get_response.py +8 -0
  21. vapi/blocks/types/blocks_list_response_item.py +8 -0
  22. vapi/blocks/types/blocks_update_response.py +8 -0
  23. vapi/blocks/types/update_block_dto_messages_item.py +7 -0
  24. vapi/blocks/types/update_block_dto_steps_item.py +7 -0
  25. vapi/blocks/types/update_block_dto_tool.py +20 -0
  26. vapi/calls/__init__.py +2 -0
  27. vapi/calls/client.py +776 -0
  28. vapi/client.py +172 -0
  29. vapi/core/__init__.py +50 -0
  30. vapi/core/api_error.py +15 -0
  31. vapi/core/client_wrapper.py +76 -0
  32. vapi/core/datetime_utils.py +28 -0
  33. vapi/core/file.py +62 -0
  34. vapi/core/http_client.py +487 -0
  35. vapi/core/jsonable_encoder.py +101 -0
  36. vapi/core/pagination.py +88 -0
  37. vapi/core/pydantic_utilities.py +296 -0
  38. vapi/core/query_encoder.py +58 -0
  39. vapi/core/remove_none_from_dict.py +11 -0
  40. vapi/core/request_options.py +32 -0
  41. vapi/core/serialization.py +272 -0
  42. vapi/environment.py +7 -0
  43. vapi/errors/__init__.py +5 -0
  44. vapi/errors/bad_request_error.py +9 -0
  45. vapi/files/__init__.py +2 -0
  46. vapi/files/client.py +544 -0
  47. vapi/logs/__init__.py +5 -0
  48. vapi/logs/client.py +367 -0
  49. vapi/logs/types/__init__.py +6 -0
  50. vapi/logs/types/logs_get_request_sort_order.py +5 -0
  51. vapi/logs/types/logs_get_request_type.py +5 -0
  52. vapi/phone_numbers/__init__.py +21 -0
  53. vapi/phone_numbers/client.py +735 -0
  54. vapi/phone_numbers/types/__init__.py +19 -0
  55. vapi/phone_numbers/types/phone_numbers_create_request.py +11 -0
  56. vapi/phone_numbers/types/phone_numbers_create_response.py +9 -0
  57. vapi/phone_numbers/types/phone_numbers_delete_response.py +9 -0
  58. vapi/phone_numbers/types/phone_numbers_get_response.py +9 -0
  59. vapi/phone_numbers/types/phone_numbers_list_response_item.py +9 -0
  60. vapi/phone_numbers/types/phone_numbers_update_response.py +9 -0
  61. vapi/phone_numbers/types/update_phone_number_dto_fallback_destination.py +7 -0
  62. vapi/py.typed +0 -0
  63. vapi/squads/__init__.py +2 -0
  64. vapi/squads/client.py +723 -0
  65. vapi/tools/__init__.py +21 -0
  66. vapi/tools/client.py +717 -0
  67. vapi/tools/types/__init__.py +19 -0
  68. vapi/tools/types/tools_create_request.py +20 -0
  69. vapi/tools/types/tools_create_response.py +12 -0
  70. vapi/tools/types/tools_delete_response.py +12 -0
  71. vapi/tools/types/tools_get_response.py +12 -0
  72. vapi/tools/types/tools_list_response_item.py +14 -0
  73. vapi/tools/types/tools_update_response.py +12 -0
  74. vapi/tools/types/update_tool_dto_messages_item.py +9 -0
  75. vapi/types/__init__.py +993 -0
  76. vapi/types/add_voice_to_provider_dto.py +34 -0
  77. vapi/types/analysis.py +38 -0
  78. vapi/types/analysis_cost.py +52 -0
  79. vapi/types/analysis_cost_analysis_type.py +5 -0
  80. vapi/types/analysis_cost_breakdown.py +80 -0
  81. vapi/types/analysis_plan.py +43 -0
  82. vapi/types/analytics_operation.py +34 -0
  83. vapi/types/analytics_operation_column.py +19 -0
  84. vapi/types/analytics_operation_operation.py +5 -0
  85. vapi/types/analytics_query.py +51 -0
  86. vapi/types/analytics_query_group_by_item.py +7 -0
  87. vapi/types/analytics_query_result.py +42 -0
  88. vapi/types/anthropic_credential.py +46 -0
  89. vapi/types/anthropic_model.py +91 -0
  90. vapi/types/anthropic_model_model.py +10 -0
  91. vapi/types/anthropic_model_tools_item.py +20 -0
  92. vapi/types/anyscale_credential.py +46 -0
  93. vapi/types/anyscale_model.py +90 -0
  94. vapi/types/anyscale_model_tools_item.py +20 -0
  95. vapi/types/artifact.py +66 -0
  96. vapi/types/artifact_messages_item.py +10 -0
  97. vapi/types/artifact_plan.py +70 -0
  98. vapi/types/assignment_mutation.py +85 -0
  99. vapi/types/assignment_mutation_conditions_item.py +7 -0
  100. vapi/types/assistant.py +330 -0
  101. vapi/types/assistant_background_sound.py +5 -0
  102. vapi/types/assistant_client_messages_item.py +23 -0
  103. vapi/types/assistant_first_message_mode.py +10 -0
  104. vapi/types/assistant_model.py +26 -0
  105. vapi/types/assistant_overrides.py +316 -0
  106. vapi/types/assistant_overrides_background_sound.py +5 -0
  107. vapi/types/assistant_overrides_client_messages_item.py +23 -0
  108. vapi/types/assistant_overrides_first_message_mode.py +10 -0
  109. vapi/types/assistant_overrides_model.py +26 -0
  110. vapi/types/assistant_overrides_server_messages_item.py +24 -0
  111. vapi/types/assistant_overrides_transcriber.py +8 -0
  112. vapi/types/assistant_overrides_voice.py +24 -0
  113. vapi/types/assistant_server_messages_item.py +24 -0
  114. vapi/types/assistant_transcriber.py +8 -0
  115. vapi/types/assistant_voice.py +24 -0
  116. vapi/types/azure_open_ai_credential.py +52 -0
  117. vapi/types/azure_open_ai_credential_models_item.py +17 -0
  118. vapi/types/azure_open_ai_credential_region.py +24 -0
  119. vapi/types/azure_voice.py +52 -0
  120. vapi/types/azure_voice_id.py +6 -0
  121. vapi/types/azure_voice_id_enum.py +5 -0
  122. vapi/types/block_complete_message.py +33 -0
  123. vapi/types/block_complete_message_conditions_item.py +7 -0
  124. vapi/types/block_start_message.py +33 -0
  125. vapi/types/block_start_message_conditions_item.py +7 -0
  126. vapi/types/bot_message.py +54 -0
  127. vapi/types/bucket_plan.py +72 -0
  128. vapi/types/buy_phone_number_dto.py +81 -0
  129. vapi/types/buy_phone_number_dto_fallback_destination.py +7 -0
  130. vapi/types/byo_phone_number.py +126 -0
  131. vapi/types/byo_phone_number_fallback_destination.py +7 -0
  132. vapi/types/byo_sip_trunk_credential.py +85 -0
  133. vapi/types/call.py +241 -0
  134. vapi/types/call_costs_item.py +11 -0
  135. vapi/types/call_destination.py +7 -0
  136. vapi/types/call_ended_reason.py +177 -0
  137. vapi/types/call_messages_item.py +10 -0
  138. vapi/types/call_paginated_response.py +32 -0
  139. vapi/types/call_phone_call_provider.py +5 -0
  140. vapi/types/call_phone_call_transport.py +5 -0
  141. vapi/types/call_status.py +5 -0
  142. vapi/types/call_type.py +5 -0
  143. vapi/types/callback_step.py +116 -0
  144. vapi/types/callback_step_block.py +11 -0
  145. vapi/types/cartesia_credential.py +46 -0
  146. vapi/types/cartesia_voice.py +58 -0
  147. vapi/types/cartesia_voice_language.py +5 -0
  148. vapi/types/cartesia_voice_model.py +5 -0
  149. vapi/types/chunk_plan.py +70 -0
  150. vapi/types/client_inbound_message.py +23 -0
  151. vapi/types/client_inbound_message_add_message.py +28 -0
  152. vapi/types/client_inbound_message_control.py +32 -0
  153. vapi/types/client_inbound_message_control_control.py +7 -0
  154. vapi/types/client_inbound_message_message.py +10 -0
  155. vapi/types/client_inbound_message_say.py +36 -0
  156. vapi/types/client_message.py +23 -0
  157. vapi/types/client_message_conversation_update.py +38 -0
  158. vapi/types/client_message_conversation_update_messages_item.py +12 -0
  159. vapi/types/client_message_hang.py +27 -0
  160. vapi/types/client_message_language_changed.py +27 -0
  161. vapi/types/client_message_message.py +28 -0
  162. vapi/types/client_message_metadata.py +27 -0
  163. vapi/types/client_message_model_output.py +27 -0
  164. vapi/types/client_message_speech_update.py +34 -0
  165. vapi/types/client_message_speech_update_role.py +5 -0
  166. vapi/types/client_message_speech_update_status.py +5 -0
  167. vapi/types/client_message_tool_calls.py +40 -0
  168. vapi/types/client_message_tool_calls_result.py +31 -0
  169. vapi/types/client_message_tool_calls_tool_with_tool_call_list_item.py +10 -0
  170. vapi/types/client_message_transcript.py +43 -0
  171. vapi/types/client_message_transcript_role.py +5 -0
  172. vapi/types/client_message_transcript_transcript_type.py +5 -0
  173. vapi/types/client_message_user_interrupted.py +22 -0
  174. vapi/types/client_message_voice_input.py +27 -0
  175. vapi/types/clone_voice_dto.py +37 -0
  176. vapi/types/condition.py +33 -0
  177. vapi/types/condition_operator.py +5 -0
  178. vapi/types/conversation_block.py +109 -0
  179. vapi/types/conversation_block_messages_item.py +7 -0
  180. vapi/types/cost_breakdown.py +78 -0
  181. vapi/types/create_anthropic_credential_dto.py +25 -0
  182. vapi/types/create_anyscale_credential_dto.py +25 -0
  183. vapi/types/create_assistant_dto.py +309 -0
  184. vapi/types/create_assistant_dto_background_sound.py +5 -0
  185. vapi/types/create_assistant_dto_client_messages_item.py +23 -0
  186. vapi/types/create_assistant_dto_first_message_mode.py +10 -0
  187. vapi/types/create_assistant_dto_model.py +26 -0
  188. vapi/types/create_assistant_dto_server_messages_item.py +24 -0
  189. vapi/types/create_assistant_dto_transcriber.py +8 -0
  190. vapi/types/create_assistant_dto_voice.py +24 -0
  191. vapi/types/create_azure_open_ai_credential_dto.py +31 -0
  192. vapi/types/create_azure_open_ai_credential_dto_models_item.py +17 -0
  193. vapi/types/create_azure_open_ai_credential_dto_region.py +24 -0
  194. vapi/types/create_byo_phone_number_dto.py +105 -0
  195. vapi/types/create_byo_phone_number_dto_fallback_destination.py +7 -0
  196. vapi/types/create_byo_sip_trunk_credential_dto.py +64 -0
  197. vapi/types/create_cartesia_credential_dto.py +25 -0
  198. vapi/types/create_conversation_block_dto.py +88 -0
  199. vapi/types/create_conversation_block_dto_messages_item.py +7 -0
  200. vapi/types/create_custom_llm_credential_dto.py +25 -0
  201. vapi/types/create_customer_dto.py +59 -0
  202. vapi/types/create_deep_infra_credential_dto.py +25 -0
  203. vapi/types/create_deepgram_credential_dto.py +32 -0
  204. vapi/types/create_dtmf_tool_dto.py +61 -0
  205. vapi/types/create_dtmf_tool_dto_messages_item.py +11 -0
  206. vapi/types/create_eleven_labs_credential_dto.py +25 -0
  207. vapi/types/create_end_call_tool_dto.py +61 -0
  208. vapi/types/create_end_call_tool_dto_messages_item.py +11 -0
  209. vapi/types/create_function_tool_dto.py +61 -0
  210. vapi/types/create_function_tool_dto_messages_item.py +11 -0
  211. vapi/types/create_gcp_credential_dto.py +41 -0
  212. vapi/types/create_ghl_tool_dto.py +63 -0
  213. vapi/types/create_ghl_tool_dto_messages_item.py +11 -0
  214. vapi/types/create_gladia_credential_dto.py +25 -0
  215. vapi/types/create_go_high_level_credential_dto.py +25 -0
  216. vapi/types/create_groq_credential_dto.py +25 -0
  217. vapi/types/create_lmnt_credential_dto.py +25 -0
  218. vapi/types/create_make_credential_dto.py +35 -0
  219. vapi/types/create_make_tool_dto.py +63 -0
  220. vapi/types/create_make_tool_dto_messages_item.py +11 -0
  221. vapi/types/create_open_ai_credential_dto.py +25 -0
  222. vapi/types/create_open_router_credential_dto.py +25 -0
  223. vapi/types/create_org_dto.py +63 -0
  224. vapi/types/create_outbound_call_dto.py +104 -0
  225. vapi/types/create_output_tool_dto.py +61 -0
  226. vapi/types/create_output_tool_dto_messages_item.py +11 -0
  227. vapi/types/create_perplexity_ai_credential_dto.py +25 -0
  228. vapi/types/create_play_ht_credential_dto.py +27 -0
  229. vapi/types/create_rime_ai_credential_dto.py +25 -0
  230. vapi/types/create_runpod_credential_dto.py +25 -0
  231. vapi/types/create_s_3_credential_dto.py +51 -0
  232. vapi/types/create_squad_dto.py +52 -0
  233. vapi/types/create_together_ai_credential_dto.py +25 -0
  234. vapi/types/create_token_dto.py +34 -0
  235. vapi/types/create_token_dto_tag.py +5 -0
  236. vapi/types/create_tool_call_block_dto.py +75 -0
  237. vapi/types/create_tool_call_block_dto_messages_item.py +7 -0
  238. vapi/types/create_tool_call_block_dto_tool.py +20 -0
  239. vapi/types/create_tool_template_dto.py +38 -0
  240. vapi/types/create_tool_template_dto_details.py +20 -0
  241. vapi/types/create_tool_template_dto_provider.py +5 -0
  242. vapi/types/create_tool_template_dto_provider_details.py +10 -0
  243. vapi/types/create_tool_template_dto_visibility.py +5 -0
  244. vapi/types/create_transfer_call_tool_dto.py +67 -0
  245. vapi/types/create_transfer_call_tool_dto_destinations_item.py +11 -0
  246. vapi/types/create_transfer_call_tool_dto_messages_item.py +11 -0
  247. vapi/types/create_twilio_credential_dto.py +27 -0
  248. vapi/types/create_twilio_phone_number_dto.py +92 -0
  249. vapi/types/create_twilio_phone_number_dto_fallback_destination.py +7 -0
  250. vapi/types/create_vapi_phone_number_dto.py +84 -0
  251. vapi/types/create_vapi_phone_number_dto_fallback_destination.py +7 -0
  252. vapi/types/create_voicemail_tool_dto.py +65 -0
  253. vapi/types/create_voicemail_tool_dto_messages_item.py +11 -0
  254. vapi/types/create_vonage_credential_dto.py +27 -0
  255. vapi/types/create_vonage_phone_number_dto.py +87 -0
  256. vapi/types/create_vonage_phone_number_dto_fallback_destination.py +7 -0
  257. vapi/types/create_web_call_dto.py +63 -0
  258. vapi/types/create_workflow_block_dto.py +78 -0
  259. vapi/types/create_workflow_block_dto_messages_item.py +7 -0
  260. vapi/types/create_workflow_block_dto_steps_item.py +10 -0
  261. vapi/types/custom_llm_credential.py +46 -0
  262. vapi/types/custom_llm_model.py +115 -0
  263. vapi/types/custom_llm_model_metadata_send_mode.py +5 -0
  264. vapi/types/custom_llm_model_tools_item.py +20 -0
  265. vapi/types/deep_infra_credential.py +46 -0
  266. vapi/types/deep_infra_model.py +90 -0
  267. vapi/types/deep_infra_model_tools_item.py +20 -0
  268. vapi/types/deepgram_credential.py +53 -0
  269. vapi/types/deepgram_transcriber.py +68 -0
  270. vapi/types/deepgram_transcriber_language.py +65 -0
  271. vapi/types/deepgram_transcriber_model.py +37 -0
  272. vapi/types/deepgram_voice.py +47 -0
  273. vapi/types/deepgram_voice_id.py +6 -0
  274. vapi/types/deepgram_voice_id_enum.py +10 -0
  275. vapi/types/dtmf_tool.py +82 -0
  276. vapi/types/dtmf_tool_messages_item.py +9 -0
  277. vapi/types/eleven_labs_credential.py +46 -0
  278. vapi/types/eleven_labs_voice.py +98 -0
  279. vapi/types/eleven_labs_voice_id.py +6 -0
  280. vapi/types/eleven_labs_voice_id_enum.py +24 -0
  281. vapi/types/eleven_labs_voice_model.py +8 -0
  282. vapi/types/end_call_tool.py +82 -0
  283. vapi/types/end_call_tool_messages_item.py +9 -0
  284. vapi/types/error.py +19 -0
  285. vapi/types/exact_replacement.py +40 -0
  286. vapi/types/file.py +57 -0
  287. vapi/types/file_status.py +5 -0
  288. vapi/types/format_plan.py +64 -0
  289. vapi/types/format_plan_replacements_item.py +7 -0
  290. vapi/types/function_tool.py +82 -0
  291. vapi/types/function_tool_messages_item.py +9 -0
  292. vapi/types/function_tool_provider_details.py +35 -0
  293. vapi/types/function_tool_with_tool_call.py +67 -0
  294. vapi/types/function_tool_with_tool_call_messages_item.py +11 -0
  295. vapi/types/gcp_credential.py +62 -0
  296. vapi/types/gcp_key.py +78 -0
  297. vapi/types/ghl_tool.py +85 -0
  298. vapi/types/ghl_tool_messages_item.py +9 -0
  299. vapi/types/ghl_tool_metadata.py +22 -0
  300. vapi/types/ghl_tool_provider_details.py +41 -0
  301. vapi/types/ghl_tool_with_tool_call.py +69 -0
  302. vapi/types/ghl_tool_with_tool_call_messages_item.py +11 -0
  303. vapi/types/gladia_credential.py +46 -0
  304. vapi/types/gladia_transcriber.py +56 -0
  305. vapi/types/gladia_transcriber_language.py +109 -0
  306. vapi/types/gladia_transcriber_language_behaviour.py +7 -0
  307. vapi/types/gladia_transcriber_model.py +5 -0
  308. vapi/types/go_high_level_credential.py +46 -0
  309. vapi/types/groq_credential.py +46 -0
  310. vapi/types/groq_model.py +91 -0
  311. vapi/types/groq_model_model.py +19 -0
  312. vapi/types/groq_model_tools_item.py +20 -0
  313. vapi/types/handoff_step.py +116 -0
  314. vapi/types/handoff_step_block.py +11 -0
  315. vapi/types/import_twilio_phone_number_dto.py +91 -0
  316. vapi/types/import_twilio_phone_number_dto_fallback_destination.py +7 -0
  317. vapi/types/import_vonage_phone_number_dto.py +88 -0
  318. vapi/types/import_vonage_phone_number_dto_fallback_destination.py +7 -0
  319. vapi/types/invite_user_dto.py +21 -0
  320. vapi/types/invite_user_dto_role.py +5 -0
  321. vapi/types/json_schema.py +57 -0
  322. vapi/types/json_schema_type.py +5 -0
  323. vapi/types/knowledge_base.py +23 -0
  324. vapi/types/lmnt_credential.py +46 -0
  325. vapi/types/lmnt_voice.py +52 -0
  326. vapi/types/lmnt_voice_id.py +6 -0
  327. vapi/types/lmnt_voice_id_enum.py +5 -0
  328. vapi/types/log.py +164 -0
  329. vapi/types/log_request_http_method.py +5 -0
  330. vapi/types/log_resource.py +7 -0
  331. vapi/types/log_type.py +5 -0
  332. vapi/types/logs_paginated_response.py +22 -0
  333. vapi/types/make_credential.py +56 -0
  334. vapi/types/make_tool.py +85 -0
  335. vapi/types/make_tool_messages_item.py +9 -0
  336. vapi/types/make_tool_metadata.py +22 -0
  337. vapi/types/make_tool_provider_details.py +40 -0
  338. vapi/types/make_tool_with_tool_call.py +69 -0
  339. vapi/types/make_tool_with_tool_call_messages_item.py +11 -0
  340. vapi/types/message_plan.py +51 -0
  341. vapi/types/metrics.py +44 -0
  342. vapi/types/model_based_condition.py +54 -0
  343. vapi/types/model_cost.py +53 -0
  344. vapi/types/monitor.py +33 -0
  345. vapi/types/monitor_plan.py +43 -0
  346. vapi/types/neets_voice.py +47 -0
  347. vapi/types/neets_voice_id.py +6 -0
  348. vapi/types/neets_voice_id_enum.py +5 -0
  349. vapi/types/open_ai_credential.py +46 -0
  350. vapi/types/open_ai_function.py +35 -0
  351. vapi/types/open_ai_function_parameters.py +35 -0
  352. vapi/types/open_ai_message.py +21 -0
  353. vapi/types/open_ai_message_role.py +5 -0
  354. vapi/types/open_ai_model.py +106 -0
  355. vapi/types/open_ai_model_fallback_models_item.py +26 -0
  356. vapi/types/open_ai_model_model.py +26 -0
  357. vapi/types/open_ai_model_tools_item.py +20 -0
  358. vapi/types/open_ai_voice.py +52 -0
  359. vapi/types/open_ai_voice_id.py +5 -0
  360. vapi/types/open_router_credential.py +46 -0
  361. vapi/types/open_router_model.py +90 -0
  362. vapi/types/open_router_model_tools_item.py +20 -0
  363. vapi/types/org.py +120 -0
  364. vapi/types/org_plan.py +28 -0
  365. vapi/types/output_tool.py +82 -0
  366. vapi/types/output_tool_messages_item.py +9 -0
  367. vapi/types/pagination_meta.py +23 -0
  368. vapi/types/perplexity_ai_credential.py +46 -0
  369. vapi/types/perplexity_ai_model.py +90 -0
  370. vapi/types/perplexity_ai_model_tools_item.py +20 -0
  371. vapi/types/play_ht_credential.py +48 -0
  372. vapi/types/play_ht_voice.py +84 -0
  373. vapi/types/play_ht_voice_emotion.py +21 -0
  374. vapi/types/play_ht_voice_id.py +6 -0
  375. vapi/types/play_ht_voice_id_enum.py +8 -0
  376. vapi/types/punctuation_boundary.py +7 -0
  377. vapi/types/regex_option.py +34 -0
  378. vapi/types/regex_option_type.py +5 -0
  379. vapi/types/regex_replacement.py +48 -0
  380. vapi/types/rime_ai_credential.py +46 -0
  381. vapi/types/rime_ai_voice.py +58 -0
  382. vapi/types/rime_ai_voice_id.py +6 -0
  383. vapi/types/rime_ai_voice_id_enum.py +90 -0
  384. vapi/types/rime_ai_voice_model.py +5 -0
  385. vapi/types/rule_based_condition.py +96 -0
  386. vapi/types/rule_based_condition_operator.py +5 -0
  387. vapi/types/runpod_credential.py +46 -0
  388. vapi/types/s_3_credential.py +72 -0
  389. vapi/types/sbc_configuration.py +17 -0
  390. vapi/types/server.py +40 -0
  391. vapi/types/server_message.py +40 -0
  392. vapi/types/server_message_assistant_request.py +96 -0
  393. vapi/types/server_message_assistant_request_phone_number.py +11 -0
  394. vapi/types/server_message_conversation_update.py +110 -0
  395. vapi/types/server_message_conversation_update_messages_item.py +12 -0
  396. vapi/types/server_message_conversation_update_phone_number.py +11 -0
  397. vapi/types/server_message_end_of_call_report.py +134 -0
  398. vapi/types/server_message_end_of_call_report_costs_item.py +13 -0
  399. vapi/types/server_message_end_of_call_report_ended_reason.py +177 -0
  400. vapi/types/server_message_end_of_call_report_phone_number.py +11 -0
  401. vapi/types/server_message_hang.py +101 -0
  402. vapi/types/server_message_hang_phone_number.py +11 -0
  403. vapi/types/server_message_language_changed.py +101 -0
  404. vapi/types/server_message_language_changed_phone_number.py +11 -0
  405. vapi/types/server_message_message.py +38 -0
  406. vapi/types/server_message_model_output.py +101 -0
  407. vapi/types/server_message_model_output_phone_number.py +11 -0
  408. vapi/types/server_message_phone_call_control.py +110 -0
  409. vapi/types/server_message_phone_call_control_destination.py +7 -0
  410. vapi/types/server_message_phone_call_control_phone_number.py +11 -0
  411. vapi/types/server_message_phone_call_control_request.py +5 -0
  412. vapi/types/server_message_response.py +39 -0
  413. vapi/types/server_message_response_assistant_request.py +80 -0
  414. vapi/types/server_message_response_assistant_request_destination.py +7 -0
  415. vapi/types/server_message_response_message_response.py +14 -0
  416. vapi/types/server_message_response_tool_calls.py +28 -0
  417. vapi/types/server_message_response_transfer_destination_request.py +32 -0
  418. vapi/types/server_message_response_transfer_destination_request_destination.py +11 -0
  419. vapi/types/server_message_response_voice_request.py +44 -0
  420. vapi/types/server_message_speech_update.py +108 -0
  421. vapi/types/server_message_speech_update_phone_number.py +11 -0
  422. vapi/types/server_message_speech_update_role.py +5 -0
  423. vapi/types/server_message_speech_update_status.py +5 -0
  424. vapi/types/server_message_status_update.py +145 -0
  425. vapi/types/server_message_status_update_destination.py +7 -0
  426. vapi/types/server_message_status_update_ended_reason.py +177 -0
  427. vapi/types/server_message_status_update_messages_item.py +12 -0
  428. vapi/types/server_message_status_update_phone_number.py +11 -0
  429. vapi/types/server_message_status_update_status.py +7 -0
  430. vapi/types/server_message_tool_calls.py +112 -0
  431. vapi/types/server_message_tool_calls_phone_number.py +11 -0
  432. vapi/types/server_message_tool_calls_tool_with_tool_call_list_item.py +10 -0
  433. vapi/types/server_message_transcript.py +115 -0
  434. vapi/types/server_message_transcript_phone_number.py +11 -0
  435. vapi/types/server_message_transcript_role.py +5 -0
  436. vapi/types/server_message_transcript_transcript_type.py +5 -0
  437. vapi/types/server_message_transfer_destination_request.py +98 -0
  438. vapi/types/server_message_transfer_destination_request_phone_number.py +11 -0
  439. vapi/types/server_message_transfer_update.py +116 -0
  440. vapi/types/server_message_transfer_update_destination.py +11 -0
  441. vapi/types/server_message_transfer_update_phone_number.py +11 -0
  442. vapi/types/server_message_user_interrupted.py +96 -0
  443. vapi/types/server_message_user_interrupted_phone_number.py +11 -0
  444. vapi/types/server_message_voice_input.py +101 -0
  445. vapi/types/server_message_voice_input_phone_number.py +11 -0
  446. vapi/types/server_message_voice_request.py +128 -0
  447. vapi/types/server_message_voice_request_phone_number.py +11 -0
  448. vapi/types/sip_trunk_gateway.py +79 -0
  449. vapi/types/sip_trunk_gateway_outbound_protocol.py +5 -0
  450. vapi/types/sip_trunk_outbound_authentication_plan.py +35 -0
  451. vapi/types/sip_trunk_outbound_sip_register_plan.py +21 -0
  452. vapi/types/squad.py +73 -0
  453. vapi/types/squad_member_dto.py +60 -0
  454. vapi/types/start_speaking_plan.py +62 -0
  455. vapi/types/step_destination.py +28 -0
  456. vapi/types/step_destination_conditions_item.py +7 -0
  457. vapi/types/stop_speaking_plan.py +65 -0
  458. vapi/types/structured_data_plan.py +66 -0
  459. vapi/types/success_evaluation_plan.py +75 -0
  460. vapi/types/success_evaluation_plan_rubric.py +17 -0
  461. vapi/types/summary_plan.py +56 -0
  462. vapi/types/sync_voice_library_dto.py +23 -0
  463. vapi/types/sync_voice_library_dto_providers_item.py +10 -0
  464. vapi/types/system_message.py +39 -0
  465. vapi/types/talkscriber_transcriber.py +33 -0
  466. vapi/types/talkscriber_transcriber_language.py +109 -0
  467. vapi/types/template.py +58 -0
  468. vapi/types/template_details.py +20 -0
  469. vapi/types/template_provider.py +5 -0
  470. vapi/types/template_provider_details.py +8 -0
  471. vapi/types/template_visibility.py +5 -0
  472. vapi/types/time_range.py +47 -0
  473. vapi/types/time_range_step.py +8 -0
  474. vapi/types/together_ai_credential.py +46 -0
  475. vapi/types/together_ai_model.py +90 -0
  476. vapi/types/together_ai_model_tools_item.py +20 -0
  477. vapi/types/token.py +62 -0
  478. vapi/types/token_restrictions.py +53 -0
  479. vapi/types/token_tag.py +5 -0
  480. vapi/types/tool_call.py +33 -0
  481. vapi/types/tool_call_block.py +96 -0
  482. vapi/types/tool_call_block_messages_item.py +7 -0
  483. vapi/types/tool_call_block_tool.py +20 -0
  484. vapi/types/tool_call_function.py +27 -0
  485. vapi/types/tool_call_message.py +46 -0
  486. vapi/types/tool_call_result.py +62 -0
  487. vapi/types/tool_call_result_message.py +49 -0
  488. vapi/types/tool_call_result_message_item.py +7 -0
  489. vapi/types/tool_message_complete.py +74 -0
  490. vapi/types/tool_message_complete_role.py +5 -0
  491. vapi/types/tool_message_delayed.py +49 -0
  492. vapi/types/tool_message_failed.py +50 -0
  493. vapi/types/tool_message_start.py +37 -0
  494. vapi/types/tool_template_metadata.py +23 -0
  495. vapi/types/tool_template_setup.py +24 -0
  496. vapi/types/transcriber_cost.py +46 -0
  497. vapi/types/transcript_plan.py +66 -0
  498. vapi/types/transcription_endpointing_plan.py +52 -0
  499. vapi/types/transfer_call_tool.py +88 -0
  500. vapi/types/transfer_call_tool_destinations_item.py +11 -0
  501. vapi/types/transfer_call_tool_messages_item.py +11 -0
  502. vapi/types/transfer_destination_assistant.py +90 -0
  503. vapi/types/transfer_destination_number.py +77 -0
  504. vapi/types/transfer_destination_sip.py +39 -0
  505. vapi/types/transfer_destination_step.py +39 -0
  506. vapi/types/transfer_mode.py +5 -0
  507. vapi/types/transport_configuration_twilio.py +55 -0
  508. vapi/types/transport_configuration_twilio_recording_channels.py +5 -0
  509. vapi/types/transport_cost.py +32 -0
  510. vapi/types/twilio_credential.py +48 -0
  511. vapi/types/twilio_phone_number.py +113 -0
  512. vapi/types/twilio_phone_number_fallback_destination.py +7 -0
  513. vapi/types/twilio_voicemail_detection.py +107 -0
  514. vapi/types/twilio_voicemail_detection_voicemail_detection_types_item.py +10 -0
  515. vapi/types/update_anthropic_credential_dto.py +25 -0
  516. vapi/types/update_anyscale_credential_dto.py +25 -0
  517. vapi/types/update_azure_open_ai_credential_dto.py +31 -0
  518. vapi/types/update_azure_open_ai_credential_dto_models_item.py +17 -0
  519. vapi/types/update_azure_open_ai_credential_dto_region.py +24 -0
  520. vapi/types/update_byo_sip_trunk_credential_dto.py +64 -0
  521. vapi/types/update_cartesia_credential_dto.py +25 -0
  522. vapi/types/update_custom_llm_credential_dto.py +25 -0
  523. vapi/types/update_deep_infra_credential_dto.py +25 -0
  524. vapi/types/update_deepgram_credential_dto.py +32 -0
  525. vapi/types/update_eleven_labs_credential_dto.py +25 -0
  526. vapi/types/update_gcp_credential_dto.py +41 -0
  527. vapi/types/update_gladia_credential_dto.py +25 -0
  528. vapi/types/update_go_high_level_credential_dto.py +25 -0
  529. vapi/types/update_groq_credential_dto.py +25 -0
  530. vapi/types/update_lmnt_credential_dto.py +25 -0
  531. vapi/types/update_make_credential_dto.py +35 -0
  532. vapi/types/update_open_ai_credential_dto.py +25 -0
  533. vapi/types/update_open_router_credential_dto.py +25 -0
  534. vapi/types/update_org_dto.py +63 -0
  535. vapi/types/update_perplexity_ai_credential_dto.py +25 -0
  536. vapi/types/update_play_ht_credential_dto.py +27 -0
  537. vapi/types/update_rime_ai_credential_dto.py +25 -0
  538. vapi/types/update_runpod_credential_dto.py +25 -0
  539. vapi/types/update_s_3_credential_dto.py +51 -0
  540. vapi/types/update_together_ai_credential_dto.py +25 -0
  541. vapi/types/update_tool_template_dto.py +38 -0
  542. vapi/types/update_tool_template_dto_details.py +20 -0
  543. vapi/types/update_tool_template_dto_provider.py +5 -0
  544. vapi/types/update_tool_template_dto_provider_details.py +10 -0
  545. vapi/types/update_tool_template_dto_visibility.py +5 -0
  546. vapi/types/update_twilio_credential_dto.py +27 -0
  547. vapi/types/update_user_role_dto.py +23 -0
  548. vapi/types/update_user_role_dto_role.py +5 -0
  549. vapi/types/update_vonage_credential_dto.py +27 -0
  550. vapi/types/user.py +47 -0
  551. vapi/types/user_message.py +49 -0
  552. vapi/types/vapi_cost.py +32 -0
  553. vapi/types/vapi_model.py +102 -0
  554. vapi/types/vapi_model_steps_item.py +7 -0
  555. vapi/types/vapi_model_tools_item.py +20 -0
  556. vapi/types/vapi_phone_number.py +105 -0
  557. vapi/types/vapi_phone_number_fallback_destination.py +7 -0
  558. vapi/types/voice_cost.py +46 -0
  559. vapi/types/voice_library.py +126 -0
  560. vapi/types/voice_library_gender.py +5 -0
  561. vapi/types/voice_library_voice_response.py +27 -0
  562. vapi/types/vonage_credential.py +64 -0
  563. vapi/types/vonage_phone_number.py +108 -0
  564. vapi/types/vonage_phone_number_fallback_destination.py +7 -0
  565. vapi/types/workflow_block.py +99 -0
  566. vapi/types/workflow_block_messages_item.py +7 -0
  567. vapi/types/workflow_block_steps_item.py +7 -0
  568. vapi/version.py +3 -0
  569. vapi_server_sdk-0.0.0a7.dist-info/METADATA +179 -0
  570. vapi_server_sdk-0.0.0a7.dist-info/RECORD +571 -0
  571. vapi_server_sdk-0.0.0a7.dist-info/WHEEL +4 -0
@@ -0,0 +1,1593 @@
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.assistant import Assistant
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.create_assistant_dto_transcriber import CreateAssistantDtoTranscriber
13
+ from ..types.create_assistant_dto_model import CreateAssistantDtoModel
14
+ from ..types.create_assistant_dto_voice import CreateAssistantDtoVoice
15
+ from ..types.create_assistant_dto_first_message_mode import CreateAssistantDtoFirstMessageMode
16
+ from ..types.create_assistant_dto_client_messages_item import CreateAssistantDtoClientMessagesItem
17
+ from ..types.create_assistant_dto_server_messages_item import CreateAssistantDtoServerMessagesItem
18
+ from ..types.create_assistant_dto_background_sound import CreateAssistantDtoBackgroundSound
19
+ from ..types.transport_configuration_twilio import TransportConfigurationTwilio
20
+ from ..types.twilio_voicemail_detection import TwilioVoicemailDetection
21
+ from ..types.analysis_plan import AnalysisPlan
22
+ from ..types.artifact_plan import ArtifactPlan
23
+ from ..types.message_plan import MessagePlan
24
+ from ..types.start_speaking_plan import StartSpeakingPlan
25
+ from ..types.stop_speaking_plan import StopSpeakingPlan
26
+ from ..types.monitor_plan import MonitorPlan
27
+ from ..core.serialization import convert_and_respect_annotation_metadata
28
+ from ..core.jsonable_encoder import jsonable_encoder
29
+ from .types.update_assistant_dto_transcriber import UpdateAssistantDtoTranscriber
30
+ from .types.update_assistant_dto_model import UpdateAssistantDtoModel
31
+ from .types.update_assistant_dto_voice import UpdateAssistantDtoVoice
32
+ from .types.update_assistant_dto_first_message_mode import UpdateAssistantDtoFirstMessageMode
33
+ from .types.update_assistant_dto_client_messages_item import UpdateAssistantDtoClientMessagesItem
34
+ from .types.update_assistant_dto_server_messages_item import UpdateAssistantDtoServerMessagesItem
35
+ from .types.update_assistant_dto_background_sound import UpdateAssistantDtoBackgroundSound
36
+ from ..core.client_wrapper import AsyncClientWrapper
37
+
38
+ # this is used as the default value for optional parameters
39
+ OMIT = typing.cast(typing.Any, ...)
40
+
41
+
42
+ class AssistantsClient:
43
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
44
+ self._client_wrapper = client_wrapper
45
+
46
+ def list(
47
+ self,
48
+ *,
49
+ limit: typing.Optional[float] = None,
50
+ created_at_gt: typing.Optional[dt.datetime] = None,
51
+ created_at_lt: typing.Optional[dt.datetime] = None,
52
+ created_at_ge: typing.Optional[dt.datetime] = None,
53
+ created_at_le: typing.Optional[dt.datetime] = None,
54
+ updated_at_gt: typing.Optional[dt.datetime] = None,
55
+ updated_at_lt: typing.Optional[dt.datetime] = None,
56
+ updated_at_ge: typing.Optional[dt.datetime] = None,
57
+ updated_at_le: typing.Optional[dt.datetime] = None,
58
+ request_options: typing.Optional[RequestOptions] = None,
59
+ ) -> typing.List[Assistant]:
60
+ """
61
+ Parameters
62
+ ----------
63
+ limit : typing.Optional[float]
64
+ This is the maximum number of items to return. Defaults to 100.
65
+
66
+ created_at_gt : typing.Optional[dt.datetime]
67
+ This will return items where the createdAt is greater than the specified value.
68
+
69
+ created_at_lt : typing.Optional[dt.datetime]
70
+ This will return items where the createdAt is less than the specified value.
71
+
72
+ created_at_ge : typing.Optional[dt.datetime]
73
+ This will return items where the createdAt is greater than or equal to the specified value.
74
+
75
+ created_at_le : typing.Optional[dt.datetime]
76
+ This will return items where the createdAt is less than or equal to the specified value.
77
+
78
+ updated_at_gt : typing.Optional[dt.datetime]
79
+ This will return items where the updatedAt is greater than the specified value.
80
+
81
+ updated_at_lt : typing.Optional[dt.datetime]
82
+ This will return items where the updatedAt is less than the specified value.
83
+
84
+ updated_at_ge : typing.Optional[dt.datetime]
85
+ This will return items where the updatedAt is greater than or equal to the specified value.
86
+
87
+ updated_at_le : typing.Optional[dt.datetime]
88
+ This will return items where the updatedAt is less than or equal to the specified value.
89
+
90
+ request_options : typing.Optional[RequestOptions]
91
+ Request-specific configuration.
92
+
93
+ Returns
94
+ -------
95
+ typing.List[Assistant]
96
+
97
+
98
+ Examples
99
+ --------
100
+ from vapi import Vapi
101
+
102
+ client = Vapi(
103
+ token="YOUR_TOKEN",
104
+ )
105
+ client.assistants.list()
106
+ """
107
+ _response = self._client_wrapper.httpx_client.request(
108
+ "assistant",
109
+ method="GET",
110
+ params={
111
+ "limit": limit,
112
+ "createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
113
+ "createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
114
+ "createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
115
+ "createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
116
+ "updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
117
+ "updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
118
+ "updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
119
+ "updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
120
+ },
121
+ request_options=request_options,
122
+ )
123
+ try:
124
+ if 200 <= _response.status_code < 300:
125
+ return typing.cast(
126
+ typing.List[Assistant],
127
+ parse_obj_as(
128
+ type_=typing.List[Assistant], # type: ignore
129
+ object_=_response.json(),
130
+ ),
131
+ )
132
+ _response_json = _response.json()
133
+ except JSONDecodeError:
134
+ raise ApiError(status_code=_response.status_code, body=_response.text)
135
+ raise ApiError(status_code=_response.status_code, body=_response_json)
136
+
137
+ def create(
138
+ self,
139
+ *,
140
+ transcriber: typing.Optional[CreateAssistantDtoTranscriber] = OMIT,
141
+ model: typing.Optional[CreateAssistantDtoModel] = OMIT,
142
+ voice: typing.Optional[CreateAssistantDtoVoice] = OMIT,
143
+ first_message_mode: typing.Optional[CreateAssistantDtoFirstMessageMode] = OMIT,
144
+ hipaa_enabled: typing.Optional[bool] = OMIT,
145
+ client_messages: typing.Optional[typing.Sequence[CreateAssistantDtoClientMessagesItem]] = OMIT,
146
+ server_messages: typing.Optional[typing.Sequence[CreateAssistantDtoServerMessagesItem]] = OMIT,
147
+ silence_timeout_seconds: typing.Optional[float] = OMIT,
148
+ max_duration_seconds: typing.Optional[float] = OMIT,
149
+ background_sound: typing.Optional[CreateAssistantDtoBackgroundSound] = OMIT,
150
+ backchanneling_enabled: typing.Optional[bool] = OMIT,
151
+ background_denoising_enabled: typing.Optional[bool] = OMIT,
152
+ model_output_in_messages_enabled: typing.Optional[bool] = OMIT,
153
+ transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] = OMIT,
154
+ name: typing.Optional[str] = OMIT,
155
+ first_message: typing.Optional[str] = OMIT,
156
+ voicemail_detection: typing.Optional[TwilioVoicemailDetection] = OMIT,
157
+ voicemail_message: typing.Optional[str] = OMIT,
158
+ end_call_message: typing.Optional[str] = OMIT,
159
+ end_call_phrases: typing.Optional[typing.Sequence[str]] = OMIT,
160
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
161
+ server_url: typing.Optional[str] = OMIT,
162
+ server_url_secret: typing.Optional[str] = OMIT,
163
+ analysis_plan: typing.Optional[AnalysisPlan] = OMIT,
164
+ artifact_plan: typing.Optional[ArtifactPlan] = OMIT,
165
+ message_plan: typing.Optional[MessagePlan] = OMIT,
166
+ start_speaking_plan: typing.Optional[StartSpeakingPlan] = OMIT,
167
+ stop_speaking_plan: typing.Optional[StopSpeakingPlan] = OMIT,
168
+ monitor_plan: typing.Optional[MonitorPlan] = OMIT,
169
+ credential_ids: typing.Optional[typing.Sequence[str]] = OMIT,
170
+ request_options: typing.Optional[RequestOptions] = None,
171
+ ) -> Assistant:
172
+ """
173
+ Parameters
174
+ ----------
175
+ transcriber : typing.Optional[CreateAssistantDtoTranscriber]
176
+ These are the options for the assistant's transcriber.
177
+
178
+ model : typing.Optional[CreateAssistantDtoModel]
179
+ These are the options for the assistant's LLM.
180
+
181
+ voice : typing.Optional[CreateAssistantDtoVoice]
182
+ These are the options for the assistant's voice.
183
+
184
+ first_message_mode : typing.Optional[CreateAssistantDtoFirstMessageMode]
185
+ This is the mode for the first message. Default is 'assistant-speaks-first'.
186
+
187
+ Use:
188
+
189
+ - 'assistant-speaks-first' to have the assistant speak first.
190
+ - 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
191
+ - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).
192
+
193
+ @default 'assistant-speaks-first'
194
+
195
+ hipaa_enabled : typing.Optional[bool]
196
+ When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.
197
+
198
+ client_messages : typing.Optional[typing.Sequence[CreateAssistantDtoClientMessagesItem]]
199
+ These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.
200
+
201
+ server_messages : typing.Optional[typing.Sequence[CreateAssistantDtoServerMessagesItem]]
202
+ These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
203
+
204
+ silence_timeout_seconds : typing.Optional[float]
205
+ How many seconds of silence to wait before ending the call. Defaults to 30.
206
+
207
+ @default 30
208
+
209
+ max_duration_seconds : typing.Optional[float]
210
+ This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.
211
+
212
+ @default 600 (10 minutes)
213
+
214
+ background_sound : typing.Optional[CreateAssistantDtoBackgroundSound]
215
+ This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
216
+
217
+ backchanneling_enabled : typing.Optional[bool]
218
+ This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.
219
+
220
+ Default `false` while in beta.
221
+
222
+ @default false
223
+
224
+ background_denoising_enabled : typing.Optional[bool]
225
+ This enables filtering of noise and background speech while the user is talking.
226
+
227
+ Default `false` while in beta.
228
+
229
+ @default false
230
+
231
+ model_output_in_messages_enabled : typing.Optional[bool]
232
+ This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.
233
+
234
+ Default `false` while in beta.
235
+
236
+ @default false
237
+
238
+ transport_configurations : typing.Optional[typing.Sequence[TransportConfigurationTwilio]]
239
+ These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.
240
+
241
+ name : typing.Optional[str]
242
+ This is the name of the assistant.
243
+
244
+ This is required when you want to transfer between assistants in a call.
245
+
246
+ first_message : typing.Optional[str]
247
+ This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).
248
+
249
+ If unspecified, assistant will wait for user to speak and use the model to respond once they speak.
250
+
251
+ voicemail_detection : typing.Optional[TwilioVoicemailDetection]
252
+ These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool].
253
+ This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached.
254
+ You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
255
+
256
+ voicemail_message : typing.Optional[str]
257
+ This is the message that the assistant will say if the call is forwarded to voicemail.
258
+
259
+ If unspecified, it will hang up.
260
+
261
+ end_call_message : typing.Optional[str]
262
+ This is the message that the assistant will say if it ends the call.
263
+
264
+ If unspecified, it will hang up without saying anything.
265
+
266
+ end_call_phrases : typing.Optional[typing.Sequence[str]]
267
+ This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
268
+
269
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
270
+ This is for metadata you want to store on the assistant.
271
+
272
+ server_url : typing.Optional[str]
273
+ This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.
274
+
275
+ All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.
276
+
277
+ This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl
278
+
279
+ server_url_secret : typing.Optional[str]
280
+ This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.
281
+
282
+ Same precedence logic as serverUrl.
283
+
284
+ analysis_plan : typing.Optional[AnalysisPlan]
285
+ This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
286
+
287
+ artifact_plan : typing.Optional[ArtifactPlan]
288
+ This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`.
289
+
290
+ Note: `recordingEnabled` is currently at the root level. It will be moved to `artifactPlan` in the future, but will remain backwards compatible.
291
+
292
+ message_plan : typing.Optional[MessagePlan]
293
+ This is the plan for static predefined messages that can be spoken by the assistant during the call, like `idleMessages`.
294
+
295
+ Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.
296
+
297
+ start_speaking_plan : typing.Optional[StartSpeakingPlan]
298
+ This is the plan for when the assistant should start talking.
299
+
300
+ You should configure this if you're running into these issues:
301
+
302
+ - The assistant is too slow to start talking after the customer is done speaking.
303
+ - The assistant is too fast to start talking after the customer is done speaking.
304
+ - The assistant is so fast that it's actually interrupting the customer.
305
+
306
+ stop_speaking_plan : typing.Optional[StopSpeakingPlan]
307
+ This is the plan for when assistant should stop talking on customer interruption.
308
+
309
+ You should configure this if you're running into these issues:
310
+
311
+ - The assistant is too slow to recognize customer's interruption.
312
+ - The assistant is too fast to recognize customer's interruption.
313
+ - The assistant is getting interrupted by phrases that are just acknowledgments.
314
+ - The assistant is getting interrupted by background noises.
315
+ - The assistant is not properly stopping -- it starts talking right after getting interrupted.
316
+
317
+ monitor_plan : typing.Optional[MonitorPlan]
318
+ This is the plan for real-time monitoring of the assistant's calls.
319
+
320
+ Usage:
321
+
322
+ - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`.
323
+ - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`.
324
+
325
+ Note, `serverMessages`, `clientMessages`, `serverUrl` and `serverUrlSecret` are currently at the root level but will be moved to `monitorPlan` in the future. Will remain backwards compatible
326
+
327
+ credential_ids : typing.Optional[typing.Sequence[str]]
328
+ These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.
329
+
330
+ request_options : typing.Optional[RequestOptions]
331
+ Request-specific configuration.
332
+
333
+ Returns
334
+ -------
335
+ Assistant
336
+
337
+
338
+ Examples
339
+ --------
340
+ from vapi import Vapi
341
+
342
+ client = Vapi(
343
+ token="YOUR_TOKEN",
344
+ )
345
+ client.assistants.create()
346
+ """
347
+ _response = self._client_wrapper.httpx_client.request(
348
+ "assistant",
349
+ method="POST",
350
+ json={
351
+ "transcriber": convert_and_respect_annotation_metadata(
352
+ object_=transcriber, annotation=CreateAssistantDtoTranscriber, direction="write"
353
+ ),
354
+ "model": convert_and_respect_annotation_metadata(
355
+ object_=model, annotation=CreateAssistantDtoModel, direction="write"
356
+ ),
357
+ "voice": convert_and_respect_annotation_metadata(
358
+ object_=voice, annotation=CreateAssistantDtoVoice, direction="write"
359
+ ),
360
+ "firstMessageMode": first_message_mode,
361
+ "hipaaEnabled": hipaa_enabled,
362
+ "clientMessages": client_messages,
363
+ "serverMessages": server_messages,
364
+ "silenceTimeoutSeconds": silence_timeout_seconds,
365
+ "maxDurationSeconds": max_duration_seconds,
366
+ "backgroundSound": background_sound,
367
+ "backchannelingEnabled": backchanneling_enabled,
368
+ "backgroundDenoisingEnabled": background_denoising_enabled,
369
+ "modelOutputInMessagesEnabled": model_output_in_messages_enabled,
370
+ "transportConfigurations": convert_and_respect_annotation_metadata(
371
+ object_=transport_configurations,
372
+ annotation=typing.Sequence[TransportConfigurationTwilio],
373
+ direction="write",
374
+ ),
375
+ "name": name,
376
+ "firstMessage": first_message,
377
+ "voicemailDetection": convert_and_respect_annotation_metadata(
378
+ object_=voicemail_detection, annotation=TwilioVoicemailDetection, direction="write"
379
+ ),
380
+ "voicemailMessage": voicemail_message,
381
+ "endCallMessage": end_call_message,
382
+ "endCallPhrases": end_call_phrases,
383
+ "metadata": metadata,
384
+ "serverUrl": server_url,
385
+ "serverUrlSecret": server_url_secret,
386
+ "analysisPlan": convert_and_respect_annotation_metadata(
387
+ object_=analysis_plan, annotation=AnalysisPlan, direction="write"
388
+ ),
389
+ "artifactPlan": convert_and_respect_annotation_metadata(
390
+ object_=artifact_plan, annotation=ArtifactPlan, direction="write"
391
+ ),
392
+ "messagePlan": convert_and_respect_annotation_metadata(
393
+ object_=message_plan, annotation=MessagePlan, direction="write"
394
+ ),
395
+ "startSpeakingPlan": convert_and_respect_annotation_metadata(
396
+ object_=start_speaking_plan, annotation=StartSpeakingPlan, direction="write"
397
+ ),
398
+ "stopSpeakingPlan": convert_and_respect_annotation_metadata(
399
+ object_=stop_speaking_plan, annotation=StopSpeakingPlan, direction="write"
400
+ ),
401
+ "monitorPlan": convert_and_respect_annotation_metadata(
402
+ object_=monitor_plan, annotation=MonitorPlan, direction="write"
403
+ ),
404
+ "credentialIds": credential_ids,
405
+ },
406
+ request_options=request_options,
407
+ omit=OMIT,
408
+ )
409
+ try:
410
+ if 200 <= _response.status_code < 300:
411
+ return typing.cast(
412
+ Assistant,
413
+ parse_obj_as(
414
+ type_=Assistant, # type: ignore
415
+ object_=_response.json(),
416
+ ),
417
+ )
418
+ _response_json = _response.json()
419
+ except JSONDecodeError:
420
+ raise ApiError(status_code=_response.status_code, body=_response.text)
421
+ raise ApiError(status_code=_response.status_code, body=_response_json)
422
+
423
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assistant:
424
+ """
425
+ Parameters
426
+ ----------
427
+ id : str
428
+
429
+ request_options : typing.Optional[RequestOptions]
430
+ Request-specific configuration.
431
+
432
+ Returns
433
+ -------
434
+ Assistant
435
+
436
+
437
+ Examples
438
+ --------
439
+ from vapi import Vapi
440
+
441
+ client = Vapi(
442
+ token="YOUR_TOKEN",
443
+ )
444
+ client.assistants.get(
445
+ id="id",
446
+ )
447
+ """
448
+ _response = self._client_wrapper.httpx_client.request(
449
+ f"assistant/{jsonable_encoder(id)}",
450
+ method="GET",
451
+ request_options=request_options,
452
+ )
453
+ try:
454
+ if 200 <= _response.status_code < 300:
455
+ return typing.cast(
456
+ Assistant,
457
+ parse_obj_as(
458
+ type_=Assistant, # type: ignore
459
+ object_=_response.json(),
460
+ ),
461
+ )
462
+ _response_json = _response.json()
463
+ except JSONDecodeError:
464
+ raise ApiError(status_code=_response.status_code, body=_response.text)
465
+ raise ApiError(status_code=_response.status_code, body=_response_json)
466
+
467
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assistant:
468
+ """
469
+ Parameters
470
+ ----------
471
+ id : str
472
+
473
+ request_options : typing.Optional[RequestOptions]
474
+ Request-specific configuration.
475
+
476
+ Returns
477
+ -------
478
+ Assistant
479
+
480
+
481
+ Examples
482
+ --------
483
+ from vapi import Vapi
484
+
485
+ client = Vapi(
486
+ token="YOUR_TOKEN",
487
+ )
488
+ client.assistants.delete(
489
+ id="id",
490
+ )
491
+ """
492
+ _response = self._client_wrapper.httpx_client.request(
493
+ f"assistant/{jsonable_encoder(id)}",
494
+ method="DELETE",
495
+ request_options=request_options,
496
+ )
497
+ try:
498
+ if 200 <= _response.status_code < 300:
499
+ return typing.cast(
500
+ Assistant,
501
+ parse_obj_as(
502
+ type_=Assistant, # type: ignore
503
+ object_=_response.json(),
504
+ ),
505
+ )
506
+ _response_json = _response.json()
507
+ except JSONDecodeError:
508
+ raise ApiError(status_code=_response.status_code, body=_response.text)
509
+ raise ApiError(status_code=_response.status_code, body=_response_json)
510
+
511
+ def update(
512
+ self,
513
+ id: str,
514
+ *,
515
+ transcriber: typing.Optional[UpdateAssistantDtoTranscriber] = OMIT,
516
+ model: typing.Optional[UpdateAssistantDtoModel] = OMIT,
517
+ voice: typing.Optional[UpdateAssistantDtoVoice] = OMIT,
518
+ first_message_mode: typing.Optional[UpdateAssistantDtoFirstMessageMode] = OMIT,
519
+ hipaa_enabled: typing.Optional[bool] = OMIT,
520
+ client_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoClientMessagesItem]] = OMIT,
521
+ server_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoServerMessagesItem]] = OMIT,
522
+ silence_timeout_seconds: typing.Optional[float] = OMIT,
523
+ max_duration_seconds: typing.Optional[float] = OMIT,
524
+ background_sound: typing.Optional[UpdateAssistantDtoBackgroundSound] = OMIT,
525
+ backchanneling_enabled: typing.Optional[bool] = OMIT,
526
+ background_denoising_enabled: typing.Optional[bool] = OMIT,
527
+ model_output_in_messages_enabled: typing.Optional[bool] = OMIT,
528
+ transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] = OMIT,
529
+ name: typing.Optional[str] = OMIT,
530
+ first_message: typing.Optional[str] = OMIT,
531
+ voicemail_detection: typing.Optional[TwilioVoicemailDetection] = OMIT,
532
+ voicemail_message: typing.Optional[str] = OMIT,
533
+ end_call_message: typing.Optional[str] = OMIT,
534
+ end_call_phrases: typing.Optional[typing.Sequence[str]] = OMIT,
535
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
536
+ server_url: typing.Optional[str] = OMIT,
537
+ server_url_secret: typing.Optional[str] = OMIT,
538
+ analysis_plan: typing.Optional[AnalysisPlan] = OMIT,
539
+ artifact_plan: typing.Optional[ArtifactPlan] = OMIT,
540
+ message_plan: typing.Optional[MessagePlan] = OMIT,
541
+ start_speaking_plan: typing.Optional[StartSpeakingPlan] = OMIT,
542
+ stop_speaking_plan: typing.Optional[StopSpeakingPlan] = OMIT,
543
+ monitor_plan: typing.Optional[MonitorPlan] = OMIT,
544
+ credential_ids: typing.Optional[typing.Sequence[str]] = OMIT,
545
+ request_options: typing.Optional[RequestOptions] = None,
546
+ ) -> Assistant:
547
+ """
548
+ Parameters
549
+ ----------
550
+ id : str
551
+
552
+ transcriber : typing.Optional[UpdateAssistantDtoTranscriber]
553
+ These are the options for the assistant's transcriber.
554
+
555
+ model : typing.Optional[UpdateAssistantDtoModel]
556
+ These are the options for the assistant's LLM.
557
+
558
+ voice : typing.Optional[UpdateAssistantDtoVoice]
559
+ These are the options for the assistant's voice.
560
+
561
+ first_message_mode : typing.Optional[UpdateAssistantDtoFirstMessageMode]
562
+ This is the mode for the first message. Default is 'assistant-speaks-first'.
563
+
564
+ Use:
565
+ - 'assistant-speaks-first' to have the assistant speak first.
566
+ - 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
567
+ - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).
568
+
569
+ @default 'assistant-speaks-first'
570
+
571
+ hipaa_enabled : typing.Optional[bool]
572
+ When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.
573
+
574
+ client_messages : typing.Optional[typing.Sequence[UpdateAssistantDtoClientMessagesItem]]
575
+ These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.
576
+
577
+ server_messages : typing.Optional[typing.Sequence[UpdateAssistantDtoServerMessagesItem]]
578
+ These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
579
+
580
+ silence_timeout_seconds : typing.Optional[float]
581
+ How many seconds of silence to wait before ending the call. Defaults to 30.
582
+
583
+ @default 30
584
+
585
+ max_duration_seconds : typing.Optional[float]
586
+ This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.
587
+
588
+ @default 600 (10 minutes)
589
+
590
+ background_sound : typing.Optional[UpdateAssistantDtoBackgroundSound]
591
+ This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
592
+
593
+ backchanneling_enabled : typing.Optional[bool]
594
+ This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.
595
+
596
+ Default `false` while in beta.
597
+
598
+ @default false
599
+
600
+ background_denoising_enabled : typing.Optional[bool]
601
+ This enables filtering of noise and background speech while the user is talking.
602
+
603
+ Default `false` while in beta.
604
+
605
+ @default false
606
+
607
+ model_output_in_messages_enabled : typing.Optional[bool]
608
+ This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.
609
+
610
+ Default `false` while in beta.
611
+
612
+ @default false
613
+
614
+ transport_configurations : typing.Optional[typing.Sequence[TransportConfigurationTwilio]]
615
+ These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.
616
+
617
+ name : typing.Optional[str]
618
+ This is the name of the assistant.
619
+
620
+ This is required when you want to transfer between assistants in a call.
621
+
622
+ first_message : typing.Optional[str]
623
+ This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).
624
+
625
+ If unspecified, assistant will wait for user to speak and use the model to respond once they speak.
626
+
627
+ voicemail_detection : typing.Optional[TwilioVoicemailDetection]
628
+ These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool].
629
+ This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached.
630
+ You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
631
+
632
+ voicemail_message : typing.Optional[str]
633
+ This is the message that the assistant will say if the call is forwarded to voicemail.
634
+
635
+ If unspecified, it will hang up.
636
+
637
+ end_call_message : typing.Optional[str]
638
+ This is the message that the assistant will say if it ends the call.
639
+
640
+ If unspecified, it will hang up without saying anything.
641
+
642
+ end_call_phrases : typing.Optional[typing.Sequence[str]]
643
+ This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
644
+
645
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
646
+ This is for metadata you want to store on the assistant.
647
+
648
+ server_url : typing.Optional[str]
649
+ This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.
650
+
651
+ All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.
652
+
653
+ This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl
654
+
655
+ server_url_secret : typing.Optional[str]
656
+ This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.
657
+
658
+ Same precedence logic as serverUrl.
659
+
660
+ analysis_plan : typing.Optional[AnalysisPlan]
661
+ This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
662
+
663
+ artifact_plan : typing.Optional[ArtifactPlan]
664
+ This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`.
665
+
666
+ Note: `recordingEnabled` is currently at the root level. It will be moved to `artifactPlan` in the future, but will remain backwards compatible.
667
+
668
+ message_plan : typing.Optional[MessagePlan]
669
+ This is the plan for static predefined messages that can be spoken by the assistant during the call, like `idleMessages`.
670
+
671
+ Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.
672
+
673
+ start_speaking_plan : typing.Optional[StartSpeakingPlan]
674
+ This is the plan for when the assistant should start talking.
675
+
676
+ You should configure this if you're running into these issues:
677
+ - The assistant is too slow to start talking after the customer is done speaking.
678
+ - The assistant is too fast to start talking after the customer is done speaking.
679
+ - The assistant is so fast that it's actually interrupting the customer.
680
+
681
+ stop_speaking_plan : typing.Optional[StopSpeakingPlan]
682
+ This is the plan for when assistant should stop talking on customer interruption.
683
+
684
+ You should configure this if you're running into these issues:
685
+ - The assistant is too slow to recognize customer's interruption.
686
+ - The assistant is too fast to recognize customer's interruption.
687
+ - The assistant is getting interrupted by phrases that are just acknowledgments.
688
+ - The assistant is getting interrupted by background noises.
689
+ - The assistant is not properly stopping -- it starts talking right after getting interrupted.
690
+
691
+ monitor_plan : typing.Optional[MonitorPlan]
692
+ This is the plan for real-time monitoring of the assistant's calls.
693
+
694
+ Usage:
695
+ - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`.
696
+ - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`.
697
+
698
+ Note, `serverMessages`, `clientMessages`, `serverUrl` and `serverUrlSecret` are currently at the root level but will be moved to `monitorPlan` in the future. Will remain backwards compatible
699
+
700
+ credential_ids : typing.Optional[typing.Sequence[str]]
701
+ These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.
702
+
703
+ request_options : typing.Optional[RequestOptions]
704
+ Request-specific configuration.
705
+
706
+ Returns
707
+ -------
708
+ Assistant
709
+
710
+
711
+ Examples
712
+ --------
713
+ from vapi import Vapi
714
+
715
+ client = Vapi(
716
+ token="YOUR_TOKEN",
717
+ )
718
+ client.assistants.update(
719
+ id="id",
720
+ )
721
+ """
722
+ _response = self._client_wrapper.httpx_client.request(
723
+ f"assistant/{jsonable_encoder(id)}",
724
+ method="PATCH",
725
+ json={
726
+ "transcriber": convert_and_respect_annotation_metadata(
727
+ object_=transcriber, annotation=UpdateAssistantDtoTranscriber, direction="write"
728
+ ),
729
+ "model": convert_and_respect_annotation_metadata(
730
+ object_=model, annotation=UpdateAssistantDtoModel, direction="write"
731
+ ),
732
+ "voice": convert_and_respect_annotation_metadata(
733
+ object_=voice, annotation=UpdateAssistantDtoVoice, direction="write"
734
+ ),
735
+ "firstMessageMode": first_message_mode,
736
+ "hipaaEnabled": hipaa_enabled,
737
+ "clientMessages": client_messages,
738
+ "serverMessages": server_messages,
739
+ "silenceTimeoutSeconds": silence_timeout_seconds,
740
+ "maxDurationSeconds": max_duration_seconds,
741
+ "backgroundSound": background_sound,
742
+ "backchannelingEnabled": backchanneling_enabled,
743
+ "backgroundDenoisingEnabled": background_denoising_enabled,
744
+ "modelOutputInMessagesEnabled": model_output_in_messages_enabled,
745
+ "transportConfigurations": convert_and_respect_annotation_metadata(
746
+ object_=transport_configurations,
747
+ annotation=typing.Sequence[TransportConfigurationTwilio],
748
+ direction="write",
749
+ ),
750
+ "name": name,
751
+ "firstMessage": first_message,
752
+ "voicemailDetection": convert_and_respect_annotation_metadata(
753
+ object_=voicemail_detection, annotation=TwilioVoicemailDetection, direction="write"
754
+ ),
755
+ "voicemailMessage": voicemail_message,
756
+ "endCallMessage": end_call_message,
757
+ "endCallPhrases": end_call_phrases,
758
+ "metadata": metadata,
759
+ "serverUrl": server_url,
760
+ "serverUrlSecret": server_url_secret,
761
+ "analysisPlan": convert_and_respect_annotation_metadata(
762
+ object_=analysis_plan, annotation=AnalysisPlan, direction="write"
763
+ ),
764
+ "artifactPlan": convert_and_respect_annotation_metadata(
765
+ object_=artifact_plan, annotation=ArtifactPlan, direction="write"
766
+ ),
767
+ "messagePlan": convert_and_respect_annotation_metadata(
768
+ object_=message_plan, annotation=MessagePlan, direction="write"
769
+ ),
770
+ "startSpeakingPlan": convert_and_respect_annotation_metadata(
771
+ object_=start_speaking_plan, annotation=StartSpeakingPlan, direction="write"
772
+ ),
773
+ "stopSpeakingPlan": convert_and_respect_annotation_metadata(
774
+ object_=stop_speaking_plan, annotation=StopSpeakingPlan, direction="write"
775
+ ),
776
+ "monitorPlan": convert_and_respect_annotation_metadata(
777
+ object_=monitor_plan, annotation=MonitorPlan, direction="write"
778
+ ),
779
+ "credentialIds": credential_ids,
780
+ },
781
+ request_options=request_options,
782
+ omit=OMIT,
783
+ )
784
+ try:
785
+ if 200 <= _response.status_code < 300:
786
+ return typing.cast(
787
+ Assistant,
788
+ parse_obj_as(
789
+ type_=Assistant, # type: ignore
790
+ object_=_response.json(),
791
+ ),
792
+ )
793
+ _response_json = _response.json()
794
+ except JSONDecodeError:
795
+ raise ApiError(status_code=_response.status_code, body=_response.text)
796
+ raise ApiError(status_code=_response.status_code, body=_response_json)
797
+
798
+
799
+ class AsyncAssistantsClient:
800
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
801
+ self._client_wrapper = client_wrapper
802
+
803
+ async def list(
804
+ self,
805
+ *,
806
+ limit: typing.Optional[float] = None,
807
+ created_at_gt: typing.Optional[dt.datetime] = None,
808
+ created_at_lt: typing.Optional[dt.datetime] = None,
809
+ created_at_ge: typing.Optional[dt.datetime] = None,
810
+ created_at_le: typing.Optional[dt.datetime] = None,
811
+ updated_at_gt: typing.Optional[dt.datetime] = None,
812
+ updated_at_lt: typing.Optional[dt.datetime] = None,
813
+ updated_at_ge: typing.Optional[dt.datetime] = None,
814
+ updated_at_le: typing.Optional[dt.datetime] = None,
815
+ request_options: typing.Optional[RequestOptions] = None,
816
+ ) -> typing.List[Assistant]:
817
+ """
818
+ Parameters
819
+ ----------
820
+ limit : typing.Optional[float]
821
+ This is the maximum number of items to return. Defaults to 100.
822
+
823
+ created_at_gt : typing.Optional[dt.datetime]
824
+ This will return items where the createdAt is greater than the specified value.
825
+
826
+ created_at_lt : typing.Optional[dt.datetime]
827
+ This will return items where the createdAt is less than the specified value.
828
+
829
+ created_at_ge : typing.Optional[dt.datetime]
830
+ This will return items where the createdAt is greater than or equal to the specified value.
831
+
832
+ created_at_le : typing.Optional[dt.datetime]
833
+ This will return items where the createdAt is less than or equal to the specified value.
834
+
835
+ updated_at_gt : typing.Optional[dt.datetime]
836
+ This will return items where the updatedAt is greater than the specified value.
837
+
838
+ updated_at_lt : typing.Optional[dt.datetime]
839
+ This will return items where the updatedAt is less than the specified value.
840
+
841
+ updated_at_ge : typing.Optional[dt.datetime]
842
+ This will return items where the updatedAt is greater than or equal to the specified value.
843
+
844
+ updated_at_le : typing.Optional[dt.datetime]
845
+ This will return items where the updatedAt is less than or equal to the specified value.
846
+
847
+ request_options : typing.Optional[RequestOptions]
848
+ Request-specific configuration.
849
+
850
+ Returns
851
+ -------
852
+ typing.List[Assistant]
853
+
854
+
855
+ Examples
856
+ --------
857
+ import asyncio
858
+
859
+ from vapi import AsyncVapi
860
+
861
+ client = AsyncVapi(
862
+ token="YOUR_TOKEN",
863
+ )
864
+
865
+
866
+ async def main() -> None:
867
+ await client.assistants.list()
868
+
869
+
870
+ asyncio.run(main())
871
+ """
872
+ _response = await self._client_wrapper.httpx_client.request(
873
+ "assistant",
874
+ method="GET",
875
+ params={
876
+ "limit": limit,
877
+ "createdAtGt": serialize_datetime(created_at_gt) if created_at_gt is not None else None,
878
+ "createdAtLt": serialize_datetime(created_at_lt) if created_at_lt is not None else None,
879
+ "createdAtGe": serialize_datetime(created_at_ge) if created_at_ge is not None else None,
880
+ "createdAtLe": serialize_datetime(created_at_le) if created_at_le is not None else None,
881
+ "updatedAtGt": serialize_datetime(updated_at_gt) if updated_at_gt is not None else None,
882
+ "updatedAtLt": serialize_datetime(updated_at_lt) if updated_at_lt is not None else None,
883
+ "updatedAtGe": serialize_datetime(updated_at_ge) if updated_at_ge is not None else None,
884
+ "updatedAtLe": serialize_datetime(updated_at_le) if updated_at_le is not None else None,
885
+ },
886
+ request_options=request_options,
887
+ )
888
+ try:
889
+ if 200 <= _response.status_code < 300:
890
+ return typing.cast(
891
+ typing.List[Assistant],
892
+ parse_obj_as(
893
+ type_=typing.List[Assistant], # type: ignore
894
+ object_=_response.json(),
895
+ ),
896
+ )
897
+ _response_json = _response.json()
898
+ except JSONDecodeError:
899
+ raise ApiError(status_code=_response.status_code, body=_response.text)
900
+ raise ApiError(status_code=_response.status_code, body=_response_json)
901
+
902
+ async def create(
903
+ self,
904
+ *,
905
+ transcriber: typing.Optional[CreateAssistantDtoTranscriber] = OMIT,
906
+ model: typing.Optional[CreateAssistantDtoModel] = OMIT,
907
+ voice: typing.Optional[CreateAssistantDtoVoice] = OMIT,
908
+ first_message_mode: typing.Optional[CreateAssistantDtoFirstMessageMode] = OMIT,
909
+ hipaa_enabled: typing.Optional[bool] = OMIT,
910
+ client_messages: typing.Optional[typing.Sequence[CreateAssistantDtoClientMessagesItem]] = OMIT,
911
+ server_messages: typing.Optional[typing.Sequence[CreateAssistantDtoServerMessagesItem]] = OMIT,
912
+ silence_timeout_seconds: typing.Optional[float] = OMIT,
913
+ max_duration_seconds: typing.Optional[float] = OMIT,
914
+ background_sound: typing.Optional[CreateAssistantDtoBackgroundSound] = OMIT,
915
+ backchanneling_enabled: typing.Optional[bool] = OMIT,
916
+ background_denoising_enabled: typing.Optional[bool] = OMIT,
917
+ model_output_in_messages_enabled: typing.Optional[bool] = OMIT,
918
+ transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] = OMIT,
919
+ name: typing.Optional[str] = OMIT,
920
+ first_message: typing.Optional[str] = OMIT,
921
+ voicemail_detection: typing.Optional[TwilioVoicemailDetection] = OMIT,
922
+ voicemail_message: typing.Optional[str] = OMIT,
923
+ end_call_message: typing.Optional[str] = OMIT,
924
+ end_call_phrases: typing.Optional[typing.Sequence[str]] = OMIT,
925
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
926
+ server_url: typing.Optional[str] = OMIT,
927
+ server_url_secret: typing.Optional[str] = OMIT,
928
+ analysis_plan: typing.Optional[AnalysisPlan] = OMIT,
929
+ artifact_plan: typing.Optional[ArtifactPlan] = OMIT,
930
+ message_plan: typing.Optional[MessagePlan] = OMIT,
931
+ start_speaking_plan: typing.Optional[StartSpeakingPlan] = OMIT,
932
+ stop_speaking_plan: typing.Optional[StopSpeakingPlan] = OMIT,
933
+ monitor_plan: typing.Optional[MonitorPlan] = OMIT,
934
+ credential_ids: typing.Optional[typing.Sequence[str]] = OMIT,
935
+ request_options: typing.Optional[RequestOptions] = None,
936
+ ) -> Assistant:
937
+ """
938
+ Parameters
939
+ ----------
940
+ transcriber : typing.Optional[CreateAssistantDtoTranscriber]
941
+ These are the options for the assistant's transcriber.
942
+
943
+ model : typing.Optional[CreateAssistantDtoModel]
944
+ These are the options for the assistant's LLM.
945
+
946
+ voice : typing.Optional[CreateAssistantDtoVoice]
947
+ These are the options for the assistant's voice.
948
+
949
+ first_message_mode : typing.Optional[CreateAssistantDtoFirstMessageMode]
950
+ This is the mode for the first message. Default is 'assistant-speaks-first'.
951
+
952
+ Use:
953
+
954
+ - 'assistant-speaks-first' to have the assistant speak first.
955
+ - 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
956
+ - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).
957
+
958
+ @default 'assistant-speaks-first'
959
+
960
+ hipaa_enabled : typing.Optional[bool]
961
+ When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.
962
+
963
+ client_messages : typing.Optional[typing.Sequence[CreateAssistantDtoClientMessagesItem]]
964
+ These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.
965
+
966
+ server_messages : typing.Optional[typing.Sequence[CreateAssistantDtoServerMessagesItem]]
967
+ These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
968
+
969
+ silence_timeout_seconds : typing.Optional[float]
970
+ How many seconds of silence to wait before ending the call. Defaults to 30.
971
+
972
+ @default 30
973
+
974
+ max_duration_seconds : typing.Optional[float]
975
+ This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.
976
+
977
+ @default 600 (10 minutes)
978
+
979
+ background_sound : typing.Optional[CreateAssistantDtoBackgroundSound]
980
+ This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
981
+
982
+ backchanneling_enabled : typing.Optional[bool]
983
+ This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.
984
+
985
+ Default `false` while in beta.
986
+
987
+ @default false
988
+
989
+ background_denoising_enabled : typing.Optional[bool]
990
+ This enables filtering of noise and background speech while the user is talking.
991
+
992
+ Default `false` while in beta.
993
+
994
+ @default false
995
+
996
+ model_output_in_messages_enabled : typing.Optional[bool]
997
+ This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.
998
+
999
+ Default `false` while in beta.
1000
+
1001
+ @default false
1002
+
1003
+ transport_configurations : typing.Optional[typing.Sequence[TransportConfigurationTwilio]]
1004
+ These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.
1005
+
1006
+ name : typing.Optional[str]
1007
+ This is the name of the assistant.
1008
+
1009
+ This is required when you want to transfer between assistants in a call.
1010
+
1011
+ first_message : typing.Optional[str]
1012
+ This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).
1013
+
1014
+ If unspecified, assistant will wait for user to speak and use the model to respond once they speak.
1015
+
1016
+ voicemail_detection : typing.Optional[TwilioVoicemailDetection]
1017
+ These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool].
1018
+ This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached.
1019
+ You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
1020
+
1021
+ voicemail_message : typing.Optional[str]
1022
+ This is the message that the assistant will say if the call is forwarded to voicemail.
1023
+
1024
+ If unspecified, it will hang up.
1025
+
1026
+ end_call_message : typing.Optional[str]
1027
+ This is the message that the assistant will say if it ends the call.
1028
+
1029
+ If unspecified, it will hang up without saying anything.
1030
+
1031
+ end_call_phrases : typing.Optional[typing.Sequence[str]]
1032
+ This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
1033
+
1034
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1035
+ This is for metadata you want to store on the assistant.
1036
+
1037
+ server_url : typing.Optional[str]
1038
+ This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.
1039
+
1040
+ All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.
1041
+
1042
+ This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl
1043
+
1044
+ server_url_secret : typing.Optional[str]
1045
+ This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.
1046
+
1047
+ Same precedence logic as serverUrl.
1048
+
1049
+ analysis_plan : typing.Optional[AnalysisPlan]
1050
+ This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
1051
+
1052
+ artifact_plan : typing.Optional[ArtifactPlan]
1053
+ This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`.
1054
+
1055
+ Note: `recordingEnabled` is currently at the root level. It will be moved to `artifactPlan` in the future, but will remain backwards compatible.
1056
+
1057
+ message_plan : typing.Optional[MessagePlan]
1058
+ This is the plan for static predefined messages that can be spoken by the assistant during the call, like `idleMessages`.
1059
+
1060
+ Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.
1061
+
1062
+ start_speaking_plan : typing.Optional[StartSpeakingPlan]
1063
+ This is the plan for when the assistant should start talking.
1064
+
1065
+ You should configure this if you're running into these issues:
1066
+
1067
+ - The assistant is too slow to start talking after the customer is done speaking.
1068
+ - The assistant is too fast to start talking after the customer is done speaking.
1069
+ - The assistant is so fast that it's actually interrupting the customer.
1070
+
1071
+ stop_speaking_plan : typing.Optional[StopSpeakingPlan]
1072
+ This is the plan for when assistant should stop talking on customer interruption.
1073
+
1074
+ You should configure this if you're running into these issues:
1075
+
1076
+ - The assistant is too slow to recognize customer's interruption.
1077
+ - The assistant is too fast to recognize customer's interruption.
1078
+ - The assistant is getting interrupted by phrases that are just acknowledgments.
1079
+ - The assistant is getting interrupted by background noises.
1080
+ - The assistant is not properly stopping -- it starts talking right after getting interrupted.
1081
+
1082
+ monitor_plan : typing.Optional[MonitorPlan]
1083
+ This is the plan for real-time monitoring of the assistant's calls.
1084
+
1085
+ Usage:
1086
+
1087
+ - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`.
1088
+ - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`.
1089
+
1090
+ Note, `serverMessages`, `clientMessages`, `serverUrl` and `serverUrlSecret` are currently at the root level but will be moved to `monitorPlan` in the future. Will remain backwards compatible
1091
+
1092
+ credential_ids : typing.Optional[typing.Sequence[str]]
1093
+ These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.
1094
+
1095
+ request_options : typing.Optional[RequestOptions]
1096
+ Request-specific configuration.
1097
+
1098
+ Returns
1099
+ -------
1100
+ Assistant
1101
+
1102
+
1103
+ Examples
1104
+ --------
1105
+ import asyncio
1106
+
1107
+ from vapi import AsyncVapi
1108
+
1109
+ client = AsyncVapi(
1110
+ token="YOUR_TOKEN",
1111
+ )
1112
+
1113
+
1114
+ async def main() -> None:
1115
+ await client.assistants.create()
1116
+
1117
+
1118
+ asyncio.run(main())
1119
+ """
1120
+ _response = await self._client_wrapper.httpx_client.request(
1121
+ "assistant",
1122
+ method="POST",
1123
+ json={
1124
+ "transcriber": convert_and_respect_annotation_metadata(
1125
+ object_=transcriber, annotation=CreateAssistantDtoTranscriber, direction="write"
1126
+ ),
1127
+ "model": convert_and_respect_annotation_metadata(
1128
+ object_=model, annotation=CreateAssistantDtoModel, direction="write"
1129
+ ),
1130
+ "voice": convert_and_respect_annotation_metadata(
1131
+ object_=voice, annotation=CreateAssistantDtoVoice, direction="write"
1132
+ ),
1133
+ "firstMessageMode": first_message_mode,
1134
+ "hipaaEnabled": hipaa_enabled,
1135
+ "clientMessages": client_messages,
1136
+ "serverMessages": server_messages,
1137
+ "silenceTimeoutSeconds": silence_timeout_seconds,
1138
+ "maxDurationSeconds": max_duration_seconds,
1139
+ "backgroundSound": background_sound,
1140
+ "backchannelingEnabled": backchanneling_enabled,
1141
+ "backgroundDenoisingEnabled": background_denoising_enabled,
1142
+ "modelOutputInMessagesEnabled": model_output_in_messages_enabled,
1143
+ "transportConfigurations": convert_and_respect_annotation_metadata(
1144
+ object_=transport_configurations,
1145
+ annotation=typing.Sequence[TransportConfigurationTwilio],
1146
+ direction="write",
1147
+ ),
1148
+ "name": name,
1149
+ "firstMessage": first_message,
1150
+ "voicemailDetection": convert_and_respect_annotation_metadata(
1151
+ object_=voicemail_detection, annotation=TwilioVoicemailDetection, direction="write"
1152
+ ),
1153
+ "voicemailMessage": voicemail_message,
1154
+ "endCallMessage": end_call_message,
1155
+ "endCallPhrases": end_call_phrases,
1156
+ "metadata": metadata,
1157
+ "serverUrl": server_url,
1158
+ "serverUrlSecret": server_url_secret,
1159
+ "analysisPlan": convert_and_respect_annotation_metadata(
1160
+ object_=analysis_plan, annotation=AnalysisPlan, direction="write"
1161
+ ),
1162
+ "artifactPlan": convert_and_respect_annotation_metadata(
1163
+ object_=artifact_plan, annotation=ArtifactPlan, direction="write"
1164
+ ),
1165
+ "messagePlan": convert_and_respect_annotation_metadata(
1166
+ object_=message_plan, annotation=MessagePlan, direction="write"
1167
+ ),
1168
+ "startSpeakingPlan": convert_and_respect_annotation_metadata(
1169
+ object_=start_speaking_plan, annotation=StartSpeakingPlan, direction="write"
1170
+ ),
1171
+ "stopSpeakingPlan": convert_and_respect_annotation_metadata(
1172
+ object_=stop_speaking_plan, annotation=StopSpeakingPlan, direction="write"
1173
+ ),
1174
+ "monitorPlan": convert_and_respect_annotation_metadata(
1175
+ object_=monitor_plan, annotation=MonitorPlan, direction="write"
1176
+ ),
1177
+ "credentialIds": credential_ids,
1178
+ },
1179
+ request_options=request_options,
1180
+ omit=OMIT,
1181
+ )
1182
+ try:
1183
+ if 200 <= _response.status_code < 300:
1184
+ return typing.cast(
1185
+ Assistant,
1186
+ parse_obj_as(
1187
+ type_=Assistant, # type: ignore
1188
+ object_=_response.json(),
1189
+ ),
1190
+ )
1191
+ _response_json = _response.json()
1192
+ except JSONDecodeError:
1193
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1194
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1195
+
1196
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assistant:
1197
+ """
1198
+ Parameters
1199
+ ----------
1200
+ id : str
1201
+
1202
+ request_options : typing.Optional[RequestOptions]
1203
+ Request-specific configuration.
1204
+
1205
+ Returns
1206
+ -------
1207
+ Assistant
1208
+
1209
+
1210
+ Examples
1211
+ --------
1212
+ import asyncio
1213
+
1214
+ from vapi import AsyncVapi
1215
+
1216
+ client = AsyncVapi(
1217
+ token="YOUR_TOKEN",
1218
+ )
1219
+
1220
+
1221
+ async def main() -> None:
1222
+ await client.assistants.get(
1223
+ id="id",
1224
+ )
1225
+
1226
+
1227
+ asyncio.run(main())
1228
+ """
1229
+ _response = await self._client_wrapper.httpx_client.request(
1230
+ f"assistant/{jsonable_encoder(id)}",
1231
+ method="GET",
1232
+ request_options=request_options,
1233
+ )
1234
+ try:
1235
+ if 200 <= _response.status_code < 300:
1236
+ return typing.cast(
1237
+ Assistant,
1238
+ parse_obj_as(
1239
+ type_=Assistant, # type: ignore
1240
+ object_=_response.json(),
1241
+ ),
1242
+ )
1243
+ _response_json = _response.json()
1244
+ except JSONDecodeError:
1245
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1246
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1247
+
1248
+ async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assistant:
1249
+ """
1250
+ Parameters
1251
+ ----------
1252
+ id : str
1253
+
1254
+ request_options : typing.Optional[RequestOptions]
1255
+ Request-specific configuration.
1256
+
1257
+ Returns
1258
+ -------
1259
+ Assistant
1260
+
1261
+
1262
+ Examples
1263
+ --------
1264
+ import asyncio
1265
+
1266
+ from vapi import AsyncVapi
1267
+
1268
+ client = AsyncVapi(
1269
+ token="YOUR_TOKEN",
1270
+ )
1271
+
1272
+
1273
+ async def main() -> None:
1274
+ await client.assistants.delete(
1275
+ id="id",
1276
+ )
1277
+
1278
+
1279
+ asyncio.run(main())
1280
+ """
1281
+ _response = await self._client_wrapper.httpx_client.request(
1282
+ f"assistant/{jsonable_encoder(id)}",
1283
+ method="DELETE",
1284
+ request_options=request_options,
1285
+ )
1286
+ try:
1287
+ if 200 <= _response.status_code < 300:
1288
+ return typing.cast(
1289
+ Assistant,
1290
+ parse_obj_as(
1291
+ type_=Assistant, # type: ignore
1292
+ object_=_response.json(),
1293
+ ),
1294
+ )
1295
+ _response_json = _response.json()
1296
+ except JSONDecodeError:
1297
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1298
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1299
+
1300
+ async def update(
1301
+ self,
1302
+ id: str,
1303
+ *,
1304
+ transcriber: typing.Optional[UpdateAssistantDtoTranscriber] = OMIT,
1305
+ model: typing.Optional[UpdateAssistantDtoModel] = OMIT,
1306
+ voice: typing.Optional[UpdateAssistantDtoVoice] = OMIT,
1307
+ first_message_mode: typing.Optional[UpdateAssistantDtoFirstMessageMode] = OMIT,
1308
+ hipaa_enabled: typing.Optional[bool] = OMIT,
1309
+ client_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoClientMessagesItem]] = OMIT,
1310
+ server_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoServerMessagesItem]] = OMIT,
1311
+ silence_timeout_seconds: typing.Optional[float] = OMIT,
1312
+ max_duration_seconds: typing.Optional[float] = OMIT,
1313
+ background_sound: typing.Optional[UpdateAssistantDtoBackgroundSound] = OMIT,
1314
+ backchanneling_enabled: typing.Optional[bool] = OMIT,
1315
+ background_denoising_enabled: typing.Optional[bool] = OMIT,
1316
+ model_output_in_messages_enabled: typing.Optional[bool] = OMIT,
1317
+ transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] = OMIT,
1318
+ name: typing.Optional[str] = OMIT,
1319
+ first_message: typing.Optional[str] = OMIT,
1320
+ voicemail_detection: typing.Optional[TwilioVoicemailDetection] = OMIT,
1321
+ voicemail_message: typing.Optional[str] = OMIT,
1322
+ end_call_message: typing.Optional[str] = OMIT,
1323
+ end_call_phrases: typing.Optional[typing.Sequence[str]] = OMIT,
1324
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1325
+ server_url: typing.Optional[str] = OMIT,
1326
+ server_url_secret: typing.Optional[str] = OMIT,
1327
+ analysis_plan: typing.Optional[AnalysisPlan] = OMIT,
1328
+ artifact_plan: typing.Optional[ArtifactPlan] = OMIT,
1329
+ message_plan: typing.Optional[MessagePlan] = OMIT,
1330
+ start_speaking_plan: typing.Optional[StartSpeakingPlan] = OMIT,
1331
+ stop_speaking_plan: typing.Optional[StopSpeakingPlan] = OMIT,
1332
+ monitor_plan: typing.Optional[MonitorPlan] = OMIT,
1333
+ credential_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1334
+ request_options: typing.Optional[RequestOptions] = None,
1335
+ ) -> Assistant:
1336
+ """
1337
+ Parameters
1338
+ ----------
1339
+ id : str
1340
+
1341
+ transcriber : typing.Optional[UpdateAssistantDtoTranscriber]
1342
+ These are the options for the assistant's transcriber.
1343
+
1344
+ model : typing.Optional[UpdateAssistantDtoModel]
1345
+ These are the options for the assistant's LLM.
1346
+
1347
+ voice : typing.Optional[UpdateAssistantDtoVoice]
1348
+ These are the options for the assistant's voice.
1349
+
1350
+ first_message_mode : typing.Optional[UpdateAssistantDtoFirstMessageMode]
1351
+ This is the mode for the first message. Default is 'assistant-speaks-first'.
1352
+
1353
+ Use:
1354
+ - 'assistant-speaks-first' to have the assistant speak first.
1355
+ - 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
1356
+ - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).
1357
+
1358
+ @default 'assistant-speaks-first'
1359
+
1360
+ hipaa_enabled : typing.Optional[bool]
1361
+ When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.
1362
+
1363
+ client_messages : typing.Optional[typing.Sequence[UpdateAssistantDtoClientMessagesItem]]
1364
+ These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.
1365
+
1366
+ server_messages : typing.Optional[typing.Sequence[UpdateAssistantDtoServerMessagesItem]]
1367
+ These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
1368
+
1369
+ silence_timeout_seconds : typing.Optional[float]
1370
+ How many seconds of silence to wait before ending the call. Defaults to 30.
1371
+
1372
+ @default 30
1373
+
1374
+ max_duration_seconds : typing.Optional[float]
1375
+ This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.
1376
+
1377
+ @default 600 (10 minutes)
1378
+
1379
+ background_sound : typing.Optional[UpdateAssistantDtoBackgroundSound]
1380
+ This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
1381
+
1382
+ backchanneling_enabled : typing.Optional[bool]
1383
+ This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.
1384
+
1385
+ Default `false` while in beta.
1386
+
1387
+ @default false
1388
+
1389
+ background_denoising_enabled : typing.Optional[bool]
1390
+ This enables filtering of noise and background speech while the user is talking.
1391
+
1392
+ Default `false` while in beta.
1393
+
1394
+ @default false
1395
+
1396
+ model_output_in_messages_enabled : typing.Optional[bool]
1397
+ This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.
1398
+
1399
+ Default `false` while in beta.
1400
+
1401
+ @default false
1402
+
1403
+ transport_configurations : typing.Optional[typing.Sequence[TransportConfigurationTwilio]]
1404
+ These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.
1405
+
1406
+ name : typing.Optional[str]
1407
+ This is the name of the assistant.
1408
+
1409
+ This is required when you want to transfer between assistants in a call.
1410
+
1411
+ first_message : typing.Optional[str]
1412
+ This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).
1413
+
1414
+ If unspecified, assistant will wait for user to speak and use the model to respond once they speak.
1415
+
1416
+ voicemail_detection : typing.Optional[TwilioVoicemailDetection]
1417
+ These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool].
1418
+ This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached.
1419
+ You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
1420
+
1421
+ voicemail_message : typing.Optional[str]
1422
+ This is the message that the assistant will say if the call is forwarded to voicemail.
1423
+
1424
+ If unspecified, it will hang up.
1425
+
1426
+ end_call_message : typing.Optional[str]
1427
+ This is the message that the assistant will say if it ends the call.
1428
+
1429
+ If unspecified, it will hang up without saying anything.
1430
+
1431
+ end_call_phrases : typing.Optional[typing.Sequence[str]]
1432
+ This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
1433
+
1434
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1435
+ This is for metadata you want to store on the assistant.
1436
+
1437
+ server_url : typing.Optional[str]
1438
+ This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.
1439
+
1440
+ All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.
1441
+
1442
+ This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl
1443
+
1444
+ server_url_secret : typing.Optional[str]
1445
+ This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.
1446
+
1447
+ Same precedence logic as serverUrl.
1448
+
1449
+ analysis_plan : typing.Optional[AnalysisPlan]
1450
+ This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
1451
+
1452
+ artifact_plan : typing.Optional[ArtifactPlan]
1453
+ This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`.
1454
+
1455
+ Note: `recordingEnabled` is currently at the root level. It will be moved to `artifactPlan` in the future, but will remain backwards compatible.
1456
+
1457
+ message_plan : typing.Optional[MessagePlan]
1458
+ This is the plan for static predefined messages that can be spoken by the assistant during the call, like `idleMessages`.
1459
+
1460
+ Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.
1461
+
1462
+ start_speaking_plan : typing.Optional[StartSpeakingPlan]
1463
+ This is the plan for when the assistant should start talking.
1464
+
1465
+ You should configure this if you're running into these issues:
1466
+ - The assistant is too slow to start talking after the customer is done speaking.
1467
+ - The assistant is too fast to start talking after the customer is done speaking.
1468
+ - The assistant is so fast that it's actually interrupting the customer.
1469
+
1470
+ stop_speaking_plan : typing.Optional[StopSpeakingPlan]
1471
+ This is the plan for when assistant should stop talking on customer interruption.
1472
+
1473
+ You should configure this if you're running into these issues:
1474
+ - The assistant is too slow to recognize customer's interruption.
1475
+ - The assistant is too fast to recognize customer's interruption.
1476
+ - The assistant is getting interrupted by phrases that are just acknowledgments.
1477
+ - The assistant is getting interrupted by background noises.
1478
+ - The assistant is not properly stopping -- it starts talking right after getting interrupted.
1479
+
1480
+ monitor_plan : typing.Optional[MonitorPlan]
1481
+ This is the plan for real-time monitoring of the assistant's calls.
1482
+
1483
+ Usage:
1484
+ - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`.
1485
+ - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`.
1486
+
1487
+ Note, `serverMessages`, `clientMessages`, `serverUrl` and `serverUrlSecret` are currently at the root level but will be moved to `monitorPlan` in the future. Will remain backwards compatible
1488
+
1489
+ credential_ids : typing.Optional[typing.Sequence[str]]
1490
+ These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.
1491
+
1492
+ request_options : typing.Optional[RequestOptions]
1493
+ Request-specific configuration.
1494
+
1495
+ Returns
1496
+ -------
1497
+ Assistant
1498
+
1499
+
1500
+ Examples
1501
+ --------
1502
+ import asyncio
1503
+
1504
+ from vapi import AsyncVapi
1505
+
1506
+ client = AsyncVapi(
1507
+ token="YOUR_TOKEN",
1508
+ )
1509
+
1510
+
1511
+ async def main() -> None:
1512
+ await client.assistants.update(
1513
+ id="id",
1514
+ )
1515
+
1516
+
1517
+ asyncio.run(main())
1518
+ """
1519
+ _response = await self._client_wrapper.httpx_client.request(
1520
+ f"assistant/{jsonable_encoder(id)}",
1521
+ method="PATCH",
1522
+ json={
1523
+ "transcriber": convert_and_respect_annotation_metadata(
1524
+ object_=transcriber, annotation=UpdateAssistantDtoTranscriber, direction="write"
1525
+ ),
1526
+ "model": convert_and_respect_annotation_metadata(
1527
+ object_=model, annotation=UpdateAssistantDtoModel, direction="write"
1528
+ ),
1529
+ "voice": convert_and_respect_annotation_metadata(
1530
+ object_=voice, annotation=UpdateAssistantDtoVoice, direction="write"
1531
+ ),
1532
+ "firstMessageMode": first_message_mode,
1533
+ "hipaaEnabled": hipaa_enabled,
1534
+ "clientMessages": client_messages,
1535
+ "serverMessages": server_messages,
1536
+ "silenceTimeoutSeconds": silence_timeout_seconds,
1537
+ "maxDurationSeconds": max_duration_seconds,
1538
+ "backgroundSound": background_sound,
1539
+ "backchannelingEnabled": backchanneling_enabled,
1540
+ "backgroundDenoisingEnabled": background_denoising_enabled,
1541
+ "modelOutputInMessagesEnabled": model_output_in_messages_enabled,
1542
+ "transportConfigurations": convert_and_respect_annotation_metadata(
1543
+ object_=transport_configurations,
1544
+ annotation=typing.Sequence[TransportConfigurationTwilio],
1545
+ direction="write",
1546
+ ),
1547
+ "name": name,
1548
+ "firstMessage": first_message,
1549
+ "voicemailDetection": convert_and_respect_annotation_metadata(
1550
+ object_=voicemail_detection, annotation=TwilioVoicemailDetection, direction="write"
1551
+ ),
1552
+ "voicemailMessage": voicemail_message,
1553
+ "endCallMessage": end_call_message,
1554
+ "endCallPhrases": end_call_phrases,
1555
+ "metadata": metadata,
1556
+ "serverUrl": server_url,
1557
+ "serverUrlSecret": server_url_secret,
1558
+ "analysisPlan": convert_and_respect_annotation_metadata(
1559
+ object_=analysis_plan, annotation=AnalysisPlan, direction="write"
1560
+ ),
1561
+ "artifactPlan": convert_and_respect_annotation_metadata(
1562
+ object_=artifact_plan, annotation=ArtifactPlan, direction="write"
1563
+ ),
1564
+ "messagePlan": convert_and_respect_annotation_metadata(
1565
+ object_=message_plan, annotation=MessagePlan, direction="write"
1566
+ ),
1567
+ "startSpeakingPlan": convert_and_respect_annotation_metadata(
1568
+ object_=start_speaking_plan, annotation=StartSpeakingPlan, direction="write"
1569
+ ),
1570
+ "stopSpeakingPlan": convert_and_respect_annotation_metadata(
1571
+ object_=stop_speaking_plan, annotation=StopSpeakingPlan, direction="write"
1572
+ ),
1573
+ "monitorPlan": convert_and_respect_annotation_metadata(
1574
+ object_=monitor_plan, annotation=MonitorPlan, direction="write"
1575
+ ),
1576
+ "credentialIds": credential_ids,
1577
+ },
1578
+ request_options=request_options,
1579
+ omit=OMIT,
1580
+ )
1581
+ try:
1582
+ if 200 <= _response.status_code < 300:
1583
+ return typing.cast(
1584
+ Assistant,
1585
+ parse_obj_as(
1586
+ type_=Assistant, # type: ignore
1587
+ object_=_response.json(),
1588
+ ),
1589
+ )
1590
+ _response_json = _response.json()
1591
+ except JSONDecodeError:
1592
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1593
+ raise ApiError(status_code=_response.status_code, body=_response_json)