From 579e3b61ac57cda862eacb5c5f9b7badde187606 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:03:33 +0000 Subject: [PATCH] Release 0.0.47 --- .github/workflows/ci.yml | 9 +- .gitignore | 1 + poetry.lock | 527 ++- pyproject.toml | 47 +- reference.md | 3278 +++++++++++++++++ src/vocode/__init__.py | 355 +- .../account_connections/__init__.py | 0 src/vocode/account_connections/client.py | 865 +++++ .../{resources => }/actions/__init__.py | 0 src/vocode/actions/client.py | 576 +++ .../{resources/prompts => agents}/__init__.py | 0 src/vocode/agents/client.py | 943 +++++ src/vocode/{resources => }/calls/__init__.py | 0 src/vocode/calls/client.py | 738 ++++ .../{resources => }/calls/types/__init__.py | 0 .../calls/types/create_call_request_agent.py | 3 +- .../create_call_request_on_no_human_answer.py | 5 + src/vocode/client.py | 239 +- src/vocode/core/__init__.py | 29 + src/vocode/core/client_wrapper.py | 57 +- src/vocode/core/file.py | 43 + src/vocode/core/http_client.py | 477 +++ src/vocode/core/jsonable_encoder.py | 68 +- src/vocode/core/pydantic_utilities.py | 206 ++ src/vocode/core/query_encoder.py | 58 + src/vocode/core/remove_none_from_dict.py | 4 +- src/vocode/core/request_options.py | 32 + src/vocode/core/serialization.py | 170 + .../{resources => }/numbers/__init__.py | 6 + src/vocode/numbers/client.py | 919 +++++ .../{resources => }/numbers/types/__init__.py | 6 + .../buy_phone_number_request_inbound_agent.py | 6 + ...phone_number_request_telephony_provider.py | 5 + ...link_phone_number_request_inbound_agent.py | 6 + .../update_number_request_example_context.py | 3 +- .../update_number_request_inbound_agent.py | 7 + .../types/update_number_request_label.py | 3 +- .../update_number_request_outbound_only.py | 3 +- .../{resources/usage => prompts}/__init__.py | 0 src/vocode/prompts/client.py | 630 ++++ src/vocode/resources/__init__.py | 71 - .../resources/account_connections/client.py | 360 -- src/vocode/resources/actions/client.py | 246 -- src/vocode/resources/agents/__init__.py | 47 - src/vocode/resources/agents/client.py | 451 --- src/vocode/resources/agents/types/__init__.py | 49 - .../types/agent_params_actions_item_one.py | 78 - .../agent_params_endpointing_sensitivity.py | 25 - .../types/agent_params_ivr_navigation_mode.py | 17 - .../agents/types/agent_params_voice_one.py | 56 - src/vocode/resources/calls/client.py | 358 -- .../create_call_request_on_no_human_answer.py | 17 - src/vocode/resources/numbers/client.py | 407 -- .../update_number_request_inbound_agent.py | 8 - src/vocode/resources/prompts/client.py | 246 -- src/vocode/resources/usage/client.py | 53 - .../resources/vector_databases/client.py | 248 -- src/vocode/resources/voices/client.py | 246 -- src/vocode/resources/webhooks/client.py | 246 -- src/vocode/types/__init__.py | 440 +-- src/vocode/types/account_connection_page.py | 31 +- .../account_connection_page_items_item.py | 28 +- .../account_connection_params_request.py | 28 +- .../account_connection_response_model.py | 28 +- ...ccount_connection_update_params_request.py | 27 +- src/vocode/types/action_page.py | 31 +- src/vocode/types/action_page_items_item.py | 67 +- src/vocode/types/action_response_model.py | 67 +- .../types/action_update_params_request.py | 72 +- src/vocode/types/add_to_conference_action.py | 36 +- ...add_to_conference_action_action_trigger.py | 31 +- ...conference_action_params_action_trigger.py | 31 +- ...nce_action_update_params_action_trigger.py | 1 - ...ction_update_params_action_trigger_zero.py | 29 +- ..._conference_action_update_params_config.py | 1 - src/vocode/types/add_to_conference_config.py | 33 +- src/vocode/types/add_to_steering_pool_body.py | 19 + src/vocode/types/agent.py | 85 +- src/vocode/types/agent_actions_item.py | 67 +- .../types/agent_deepgram_keywords_value.py | 5 + .../types/agent_endpointing_sensitivity.py | 22 +- src/vocode/types/agent_ivr_navigation_mode.py | 14 +- src/vocode/types/agent_page.py | 31 +- src/vocode/types/agent_params.py | 52 + .../types/agent_params_actions_item.py | 1 - .../types/agent_params_actions_item_one.py | 18 + .../agent_params_deepgram_keywords_value.py | 5 + .../agent_params_endpointing_sensitivity.py | 5 + .../types/agent_params_ivr_navigation_mode.py | 5 + .../agent_params_openai_account_connection.py | 3 +- .../agents => }/types/agent_params_prompt.py | 3 +- .../types/agent_params_vector_database.py | 3 +- .../agents => }/types/agent_params_voice.py | 1 - src/vocode/types/agent_params_voice_one.py | 12 + .../agents => }/types/agent_params_webhook.py | 3 +- src/vocode/types/agent_update_params.py | 107 +- .../types/agent_update_params_actions.py | 1 - .../types/agent_update_params_actions_item.py | 1 - ...ate_params_ask_if_human_present_on_idle.py | 1 - .../agent_update_params_context_endpoint.py | 1 - .../agent_update_params_conversation_speed.py | 1 - .../agent_update_params_deepgram_keywords.py | 9 + ...ate_params_deepgram_keywords_zero_value.py | 5 + ...t_update_params_endpointing_sensitivity.py | 8 +- .../agent_update_params_initial_message.py | 1 - ...ent_update_params_initial_message_delay.py | 1 - ...ent_update_params_interrupt_sensitivity.py | 1 - ...agent_update_params_ivr_navigation_mode.py | 7 +- .../types/agent_update_params_language.py | 1 - .../types/agent_update_params_llm_fallback.py | 7 + src/vocode/types/agent_update_params_name.py | 1 - .../agent_update_params_noise_suppression.py | 1 - ...update_params_openai_account_connection.py | 1 - ...pdate_params_openai_model_name_override.py | 1 - .../types/agent_update_params_prompt.py | 1 - ...update_params_run_do_not_call_detection.py | 1 - .../agent_update_params_vector_database.py | 1 - src/vocode/types/agent_update_params_voice.py | 1 - .../types/agent_update_params_webhook.py | 3 +- src/vocode/types/agent_voice.py | 47 +- src/vocode/types/azure_voice.py | 36 +- .../types/azure_voice_update_params_pitch.py | 1 - .../types/azure_voice_update_params_rate.py | 1 - .../azure_voice_update_params_voice_name.py | 1 - src/vocode/types/buy_phone_number_request.py | 31 - ...phone_number_request_telephony_provider.py | 17 - src/vocode/types/call.py | 77 +- .../types/call_human_detection_result.py | 14 +- src/vocode/types/call_on_no_human_answer.py | 14 +- src/vocode/types/call_page.py | 31 +- src/vocode/types/call_stage.py | 26 +- src/vocode/types/call_stage_outcome.py | 44 +- src/vocode/types/call_status.py | 30 +- src/vocode/types/call_telephony_metadata.py | 28 +- src/vocode/types/call_telephony_provider.py | 14 +- src/vocode/types/collect_field.py | 37 +- src/vocode/types/create_call_agent_params.py | 91 +- .../create_call_agent_params_actions_item.py | 1 - ...ll_agent_params_deepgram_keywords_value.py | 5 + ...ll_agent_params_endpointing_sensitivity.py | 22 +- ...e_call_agent_params_ivr_navigation_mode.py | 14 +- ..._agent_params_openai_account_connection.py | 1 - .../types/create_call_agent_params_prompt.py | 1 - ...reate_call_agent_params_vector_database.py | 1 - .../types/create_call_agent_params_voice.py | 1 - .../types/create_call_agent_params_webhook.py | 1 - src/vocode/types/dtmf_action.py | 42 +- .../types/dtmf_action_action_trigger.py | 33 - .../dtmf_action_params_action_trigger.py | 33 - ...tmf_action_update_params_action_trigger.py | 5 +- ...ction_update_params_action_trigger_zero.py | 34 - .../types/dtmf_action_update_params_config.py | 1 - src/vocode/types/eleven_labs_voice.py | 48 +- ...eleven_labs_voice_update_params_api_key.py | 1 - ...ate_params_experimental_input_streaming.py | 1 - ...leven_labs_voice_update_params_model_id.py | 1 - ...pdate_params_optimize_streaming_latency.py | 1 - ...bs_voice_update_params_similarity_boost.py | 1 - ...even_labs_voice_update_params_stability.py | 1 - ...leven_labs_voice_update_params_voice_id.py | 1 - src/vocode/types/empty_action_config.py | 31 +- src/vocode/types/end_conversation_action.py | 40 +- .../end_conversation_action_action_trigger.py | 31 +- ...nversation_action_params_action_trigger.py | 31 +- ...ion_action_update_params_action_trigger.py | 1 - ...ction_update_params_action_trigger_zero.py | 29 +- ...onversation_action_update_params_config.py | 1 - src/vocode/types/event_type.py | 58 +- src/vocode/types/external_action.py | 36 +- .../types/external_action_action_trigger.py | 33 - src/vocode/types/external_action_config.py | 38 +- .../external_action_params_action_trigger.py | 34 - ...nal_action_update_params_action_trigger.py | 5 +- ...ction_update_params_action_trigger_zero.py | 34 - .../external_action_update_params_config.py | 1 - .../types/function_call_action_trigger.py | 34 +- .../function_call_action_trigger_config.py | 31 +- src/vocode/types/http_method.py | 18 +- src/vocode/types/http_validation_error.py | 33 +- src/vocode/types/internal_llm_fallback.py | 21 + .../types/internal_llm_fallback_provider.py | 5 + src/vocode/types/interrupt_sensitivity.py | 18 +- src/vocode/types/language.py | 58 +- src/vocode/types/normalized_agent.py | 79 +- ...ormalized_agent_deepgram_keywords_value.py | 5 + ...ormalized_agent_endpointing_sensitivity.py | 22 +- .../normalized_agent_ivr_navigation_mode.py | 14 +- ...malized_agent_openai_account_connection.py | 1 - src/vocode/types/normalized_agent_prompt.py | 1 - .../types/normalized_agent_vector_database.py | 1 - src/vocode/types/normalized_call.py | 75 +- .../normalized_call_human_detection_result.py | 14 +- .../normalized_call_on_no_human_answer.py | 14 +- src/vocode/types/normalized_call_stage.py | 28 +- .../types/normalized_call_stage_outcome.py | 44 +- ...lized_call_telephony_account_connection.py | 1 - .../normalized_call_telephony_metadata.py | 28 +- .../normalized_call_telephony_provider.py | 14 +- src/vocode/types/normalized_phone_number.py | 47 +- ...one_number_telephony_account_connection.py | 1 - ...malized_phone_number_telephony_provider.py | 14 +- src/vocode/types/normalized_prompt.py | 43 +- .../types/open_ai_account_connection.py | 34 +- .../open_ai_account_connection_params.py | 34 +- ...pen_ai_account_connection_update_params.py | 34 +- ...nt_connection_update_params_credentials.py | 1 - src/vocode/types/open_ai_credentials.py | 31 +- src/vocode/types/phone_number.py | 45 +- src/vocode/types/phone_number_page.py | 31 +- .../types/phone_number_telephony_provider.py | 14 +- .../types/phrase_based_action_trigger.py | 29 - .../phrase_based_action_trigger_config.py | 31 +- .../phrase_based_action_trigger_input.py | 21 + .../phrase_based_action_trigger_output.py | 21 + src/vocode/types/phrase_trigger.py | 35 +- src/vocode/types/pinecone_vector_database.py | 35 +- .../types/pinecone_vector_database_params.py | 35 +- .../pinecone_vector_database_update_params.py | 45 +- ..._database_update_params_api_environment.py | 1 - ...e_vector_database_update_params_api_key.py | 1 - ...one_vector_database_update_params_index.py | 1 - src/vocode/types/plan_type.py | 30 +- src/vocode/types/play_ht_voice.py | 58 +- .../types/play_ht_voice_params_quality.py | 36 +- .../types/play_ht_voice_params_version.py | 14 +- src/vocode/types/play_ht_voice_quality.py | 34 +- .../play_ht_voice_update_params_api_key.py | 1 - ...play_ht_voice_update_params_api_user_id.py | 1 - ...date_params_experimental_remove_silence.py | 1 - .../play_ht_voice_update_params_quality.py | 15 +- .../play_ht_voice_update_params_speed.py | 1 - ...play_ht_voice_update_params_temperature.py | 1 - ...ay_ht_voice_update_params_text_guidance.py | 1 - .../play_ht_voice_update_params_top_p.py | 1 - .../play_ht_voice_update_params_version.py | 5 +- ...y_ht_voice_update_params_voice_guidance.py | 1 - .../play_ht_voice_update_params_voice_id.py | 1 - src/vocode/types/play_ht_voice_version.py | 14 +- src/vocode/types/prompt.py | 43 +- src/vocode/types/prompt_page.py | 31 +- src/vocode/types/prompt_params.py | 39 +- .../types/prompt_params_prompt_template.py | 1 - src/vocode/types/prompt_template.py | 33 +- src/vocode/types/prompt_update_params.py | 41 +- .../prompt_update_params_collect_fields.py | 1 - .../types/prompt_update_params_content.py | 1 - .../prompt_update_params_context_endpoint.py | 1 - .../prompt_update_params_prompt_template.py | 1 - src/vocode/types/rime_voice.py | 36 +- src/vocode/types/rime_voice_model_id.py | 5 +- .../types/rime_voice_params_model_id.py | 5 +- .../rime_voice_update_params_model_id.py | 7 +- .../types/rime_voice_update_params_speaker.py | 1 - .../rime_voice_update_params_speed_alpha.py | 1 - src/vocode/types/set_hold_action.py | 40 +- .../types/set_hold_action_action_trigger.py | 30 +- .../set_hold_action_params_action_trigger.py | 31 +- ...old_action_update_params_action_trigger.py | 1 - ...ction_update_params_action_trigger_zero.py | 31 +- .../set_hold_action_update_params_config.py | 1 - src/vocode/types/transfer_call_action.py | 36 +- .../transfer_call_action_action_trigger.py | 30 +- ...nsfer_call_action_params_action_trigger.py | 31 +- ...all_action_update_params_action_trigger.py | 1 - ...ction_update_params_action_trigger_zero.py | 31 +- ...ansfer_call_action_update_params_config.py | 1 - src/vocode/types/transfer_call_config.py | 31 +- src/vocode/types/twilio_account_connection.py | 42 +- .../types/twilio_account_connection_params.py | 42 +- ...twilio_account_connection_update_params.py | 34 +- ...nt_connection_update_params_credentials.py | 1 - src/vocode/types/twilio_credentials.py | 31 +- src/vocode/types/twilio_telephony_metadata.py | 50 +- src/vocode/types/undefined.py | 31 +- src/vocode/types/usage.py | 35 +- src/vocode/types/validation_error.py | 31 +- src/vocode/types/vector_database_page.py | 31 +- src/vocode/types/vocode_voice.py | 22 + src/vocode/types/vocode_voice_params.py | 20 + .../types/vocode_voice_update_params.py | 21 + .../vocode_voice_update_params_voice_id.py | 6 + src/vocode/types/voice_page.py | 31 +- src/vocode/types/voice_page_items_item.py | 50 +- src/vocode/types/voice_response_model.py | 50 +- src/vocode/types/vonage_telephony_metadata.py | 31 +- src/vocode/types/webhook.py | 33 +- src/vocode/types/webhook_page.py | 31 +- src/vocode/types/webhook_params.py | 33 +- src/vocode/types/webhook_update_params.py | 39 +- .../types/webhook_update_params_method.py | 1 - .../webhook_update_params_subscriptions.py | 1 - src/vocode/types/webhook_update_params_url.py | 1 - .../vector_databases => usage}/__init__.py | 0 src/vocode/usage/client.py | 108 + .../voices => vector_databases}/__init__.py | 0 src/vocode/vector_databases/client.py | 619 ++++ src/vocode/version.py | 3 + .../webhooks => voices}/__init__.py | 0 src/vocode/voices/client.py | 568 +++ src/vocode/webhooks/__init__.py | 2 + src/vocode/webhooks/client.py | 619 ++++ tests/__init__.py | 0 tests/custom/test_client.py | 7 + tests/utils/__init__.py | 2 + tests/utils/assets/models/__init__.py | 21 + tests/utils/assets/models/circle.py | 11 + tests/utils/assets/models/color.py | 7 + .../assets/models/object_with_defaults.py | 16 + .../models/object_with_optional_field.py | 34 + tests/utils/assets/models/shape.py | 26 + tests/utils/assets/models/square.py | 11 + .../assets/models/undiscriminated_shape.py | 9 + tests/utils/test_http_client.py | 61 + tests/utils/test_query_encoding.py | 37 + tests/utils/test_serialization.py | 66 + 315 files changed, 13388 insertions(+), 7681 deletions(-) create mode 100644 reference.md rename src/vocode/{resources => }/account_connections/__init__.py (100%) create mode 100644 src/vocode/account_connections/client.py rename src/vocode/{resources => }/actions/__init__.py (100%) create mode 100644 src/vocode/actions/client.py rename src/vocode/{resources/prompts => agents}/__init__.py (100%) create mode 100644 src/vocode/agents/client.py rename src/vocode/{resources => }/calls/__init__.py (100%) create mode 100644 src/vocode/calls/client.py rename src/vocode/{resources => }/calls/types/__init__.py (100%) rename src/vocode/{resources => }/calls/types/create_call_request_agent.py (67%) create mode 100644 src/vocode/calls/types/create_call_request_on_no_human_answer.py create mode 100644 src/vocode/core/file.py create mode 100644 src/vocode/core/http_client.py create mode 100644 src/vocode/core/pydantic_utilities.py create mode 100644 src/vocode/core/query_encoder.py create mode 100644 src/vocode/core/request_options.py create mode 100644 src/vocode/core/serialization.py rename src/vocode/{resources => }/numbers/__init__.py (61%) create mode 100644 src/vocode/numbers/client.py rename src/vocode/{resources => }/numbers/types/__init__.py (57%) create mode 100644 src/vocode/numbers/types/buy_phone_number_request_inbound_agent.py create mode 100644 src/vocode/numbers/types/buy_phone_number_request_telephony_provider.py create mode 100644 src/vocode/numbers/types/link_phone_number_request_inbound_agent.py rename src/vocode/{resources => }/numbers/types/update_number_request_example_context.py (79%) create mode 100644 src/vocode/numbers/types/update_number_request_inbound_agent.py rename src/vocode/{resources => }/numbers/types/update_number_request_label.py (75%) rename src/vocode/{resources => }/numbers/types/update_number_request_outbound_only.py (77%) rename src/vocode/{resources/usage => prompts}/__init__.py (100%) create mode 100644 src/vocode/prompts/client.py delete mode 100644 src/vocode/resources/__init__.py delete mode 100644 src/vocode/resources/account_connections/client.py delete mode 100644 src/vocode/resources/actions/client.py delete mode 100644 src/vocode/resources/agents/__init__.py delete mode 100644 src/vocode/resources/agents/client.py delete mode 100644 src/vocode/resources/agents/types/__init__.py delete mode 100644 src/vocode/resources/agents/types/agent_params_actions_item_one.py delete mode 100644 src/vocode/resources/agents/types/agent_params_endpointing_sensitivity.py delete mode 100644 src/vocode/resources/agents/types/agent_params_ivr_navigation_mode.py delete mode 100644 src/vocode/resources/agents/types/agent_params_voice_one.py delete mode 100644 src/vocode/resources/calls/client.py delete mode 100644 src/vocode/resources/calls/types/create_call_request_on_no_human_answer.py delete mode 100644 src/vocode/resources/numbers/client.py delete mode 100644 src/vocode/resources/numbers/types/update_number_request_inbound_agent.py delete mode 100644 src/vocode/resources/prompts/client.py delete mode 100644 src/vocode/resources/usage/client.py delete mode 100644 src/vocode/resources/vector_databases/client.py delete mode 100644 src/vocode/resources/voices/client.py delete mode 100644 src/vocode/resources/webhooks/client.py create mode 100644 src/vocode/types/add_to_steering_pool_body.py create mode 100644 src/vocode/types/agent_deepgram_keywords_value.py create mode 100644 src/vocode/types/agent_params.py rename src/vocode/{resources/agents => }/types/agent_params_actions_item.py (99%) create mode 100644 src/vocode/types/agent_params_actions_item_one.py create mode 100644 src/vocode/types/agent_params_deepgram_keywords_value.py create mode 100644 src/vocode/types/agent_params_endpointing_sensitivity.py create mode 100644 src/vocode/types/agent_params_ivr_navigation_mode.py rename src/vocode/{resources/agents => }/types/agent_params_openai_account_connection.py (68%) rename src/vocode/{resources/agents => }/types/agent_params_prompt.py (72%) rename src/vocode/{resources/agents => }/types/agent_params_vector_database.py (65%) rename src/vocode/{resources/agents => }/types/agent_params_voice.py (99%) create mode 100644 src/vocode/types/agent_params_voice_one.py rename src/vocode/{resources/agents => }/types/agent_params_webhook.py (72%) create mode 100644 src/vocode/types/agent_update_params_deepgram_keywords.py create mode 100644 src/vocode/types/agent_update_params_deepgram_keywords_zero_value.py create mode 100644 src/vocode/types/agent_update_params_llm_fallback.py delete mode 100644 src/vocode/types/buy_phone_number_request.py delete mode 100644 src/vocode/types/buy_phone_number_request_telephony_provider.py create mode 100644 src/vocode/types/create_call_agent_params_deepgram_keywords_value.py delete mode 100644 src/vocode/types/dtmf_action_action_trigger.py delete mode 100644 src/vocode/types/dtmf_action_params_action_trigger.py delete mode 100644 src/vocode/types/dtmf_action_update_params_action_trigger_zero.py delete mode 100644 src/vocode/types/external_action_action_trigger.py delete mode 100644 src/vocode/types/external_action_params_action_trigger.py delete mode 100644 src/vocode/types/external_action_update_params_action_trigger_zero.py create mode 100644 src/vocode/types/internal_llm_fallback.py create mode 100644 src/vocode/types/internal_llm_fallback_provider.py create mode 100644 src/vocode/types/normalized_agent_deepgram_keywords_value.py delete mode 100644 src/vocode/types/phrase_based_action_trigger.py create mode 100644 src/vocode/types/phrase_based_action_trigger_input.py create mode 100644 src/vocode/types/phrase_based_action_trigger_output.py create mode 100644 src/vocode/types/vocode_voice.py create mode 100644 src/vocode/types/vocode_voice_params.py create mode 100644 src/vocode/types/vocode_voice_update_params.py create mode 100644 src/vocode/types/vocode_voice_update_params_voice_id.py rename src/vocode/{resources/vector_databases => usage}/__init__.py (100%) create mode 100644 src/vocode/usage/client.py rename src/vocode/{resources/voices => vector_databases}/__init__.py (100%) create mode 100644 src/vocode/vector_databases/client.py create mode 100644 src/vocode/version.py rename src/vocode/{resources/webhooks => voices}/__init__.py (100%) create mode 100644 src/vocode/voices/client.py create mode 100644 src/vocode/webhooks/__init__.py create mode 100644 src/vocode/webhooks/client.py delete mode 100644 tests/__init__.py create mode 100644 tests/custom/test_client.py create mode 100644 tests/utils/__init__.py create mode 100644 tests/utils/assets/models/__init__.py create mode 100644 tests/utils/assets/models/circle.py create mode 100644 tests/utils/assets/models/color.py create mode 100644 tests/utils/assets/models/object_with_defaults.py create mode 100644 tests/utils/assets/models/object_with_optional_field.py create mode 100644 tests/utils/assets/models/shape.py create mode 100644 tests/utils/assets/models/square.py create mode 100644 tests/utils/assets/models/undiscriminated_shape.py create mode 100644 tests/utils/test_http_client.py create mode 100644 tests/utils/test_query_encoding.py create mode 100644 tests/utils/test_serialization.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a5b56e..bb1b2d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.8 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 @@ -26,14 +26,15 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.8 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 - name: Install dependencies run: poetry install + - name: Test - run: poetry run pytest . + run: poetry run pytest ./tests/custom/ publish: needs: [compile, test] @@ -45,7 +46,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.8 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 diff --git a/.gitignore b/.gitignore index 42cb863..0da665f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ dist/ .mypy_cache/ __pycache__/ poetry.toml +.ruff_cache/ diff --git a/poetry.lock b/poetry.lock index afc2abd..cd3d451 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,14 +1,14 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" -version = "0.5.0" +version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, - {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] [package.dependencies] @@ -16,35 +16,35 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anyio" -version = "3.7.1" +version = "4.4.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, - {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, + {file = "anyio-4.4.0-py3-none-any.whl", hash = "sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7"}, + {file = "anyio-4.4.0.tar.gz", hash = "sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94"}, ] [package.dependencies] -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} +exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] -doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] -test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (<0.22)"] +doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (>=0.23)"] [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.7.4" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"}, + {file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"}, ] [[package]] @@ -60,13 +60,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.1" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, - {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -83,44 +83,42 @@ files = [ {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, ] -[package.dependencies] -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} - [[package]] name = "httpcore" -version = "0.17.3" +version = "1.0.5" description = "A minimal low-level HTTP client." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"}, - {file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"}, + {file = "httpcore-1.0.5-py3-none-any.whl", hash = "sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5"}, + {file = "httpcore-1.0.5.tar.gz", hash = "sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61"}, ] [package.dependencies] -anyio = ">=3.0,<5.0" certifi = "*" h11 = ">=0.13,<0.15" -sniffio = "==1.*" [package.extras] +asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] +trio = ["trio (>=0.22.0,<0.26.0)"] [[package]] name = "httpx" -version = "0.24.1" +version = "0.27.0" description = "The next generation HTTP client." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "httpx-0.24.1-py3-none-any.whl", hash = "sha256:06781eb9ac53cde990577af654bd990a4949de37a28bdb4a230d434f3a30b9bd"}, - {file = "httpx-0.24.1.tar.gz", hash = "sha256:5853a43053df830c20f8110c5e69fe44d035d850b2dfe795e196f00fdb774bdd"}, + {file = "httpx-0.27.0-py3-none-any.whl", hash = "sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5"}, + {file = "httpx-0.27.0.tar.gz", hash = "sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5"}, ] [package.dependencies] +anyio = "*" certifi = "*" -httpcore = ">=0.15.0,<0.18.0" +httpcore = "==1.*" idna = "*" sniffio = "*" @@ -141,26 +139,6 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] -[[package]] -name = "importlib-metadata" -version = "6.7.0" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, - {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, -] - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] - [[package]] name = "iniconfig" version = "2.0.0" @@ -174,44 +152,47 @@ files = [ [[package]] name = "mypy" -version = "0.971" +version = "1.0.1" description = "Optional static typing for Python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "mypy-0.971-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f2899a3cbd394da157194f913a931edfd4be5f274a88041c9dc2d9cdcb1c315c"}, - {file = "mypy-0.971-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:98e02d56ebe93981c41211c05adb630d1d26c14195d04d95e49cd97dbc046dc5"}, - {file = "mypy-0.971-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:19830b7dba7d5356d3e26e2427a2ec91c994cd92d983142cbd025ebe81d69cf3"}, - {file = "mypy-0.971-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:02ef476f6dcb86e6f502ae39a16b93285fef97e7f1ff22932b657d1ef1f28655"}, - {file = "mypy-0.971-cp310-cp310-win_amd64.whl", hash = "sha256:25c5750ba5609a0c7550b73a33deb314ecfb559c350bb050b655505e8aed4103"}, - {file = "mypy-0.971-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d3348e7eb2eea2472db611486846742d5d52d1290576de99d59edeb7cd4a42ca"}, - {file = "mypy-0.971-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3fa7a477b9900be9b7dd4bab30a12759e5abe9586574ceb944bc29cddf8f0417"}, - {file = "mypy-0.971-cp36-cp36m-win_amd64.whl", hash = "sha256:2ad53cf9c3adc43cf3bea0a7d01a2f2e86db9fe7596dfecb4496a5dda63cbb09"}, - {file = "mypy-0.971-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:855048b6feb6dfe09d3353466004490b1872887150c5bb5caad7838b57328cc8"}, - {file = "mypy-0.971-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:23488a14a83bca6e54402c2e6435467a4138785df93ec85aeff64c6170077fb0"}, - {file = "mypy-0.971-cp37-cp37m-win_amd64.whl", hash = "sha256:4b21e5b1a70dfb972490035128f305c39bc4bc253f34e96a4adf9127cf943eb2"}, - {file = "mypy-0.971-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:9796a2ba7b4b538649caa5cecd398d873f4022ed2333ffde58eaf604c4d2cb27"}, - {file = "mypy-0.971-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5a361d92635ad4ada1b1b2d3630fc2f53f2127d51cf2def9db83cba32e47c856"}, - {file = "mypy-0.971-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b793b899f7cf563b1e7044a5c97361196b938e92f0a4343a5d27966a53d2ec71"}, - {file = "mypy-0.971-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d1ea5d12c8e2d266b5fb8c7a5d2e9c0219fedfeb493b7ed60cd350322384ac27"}, - {file = "mypy-0.971-cp38-cp38-win_amd64.whl", hash = "sha256:23c7ff43fff4b0df93a186581885c8512bc50fc4d4910e0f838e35d6bb6b5e58"}, - {file = "mypy-0.971-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1f7656b69974a6933e987ee8ffb951d836272d6c0f81d727f1d0e2696074d9e6"}, - {file = "mypy-0.971-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d2022bfadb7a5c2ef410d6a7c9763188afdb7f3533f22a0a32be10d571ee4bbe"}, - {file = "mypy-0.971-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ef943c72a786b0f8d90fd76e9b39ce81fb7171172daf84bf43eaf937e9f220a9"}, - {file = "mypy-0.971-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d744f72eb39f69312bc6c2abf8ff6656973120e2eb3f3ec4f758ed47e414a4bf"}, - {file = "mypy-0.971-cp39-cp39-win_amd64.whl", hash = "sha256:77a514ea15d3007d33a9e2157b0ba9c267496acf12a7f2b9b9f8446337aac5b0"}, - {file = "mypy-0.971-py3-none-any.whl", hash = "sha256:0d054ef16b071149917085f51f89555a576e2618d5d9dd70bd6eea6410af3ac9"}, - {file = "mypy-0.971.tar.gz", hash = "sha256:40b0f21484238269ae6a57200c807d80debc6459d444c0489a102d7c6a75fa56"}, + {file = "mypy-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:71a808334d3f41ef011faa5a5cd8153606df5fc0b56de5b2e89566c8093a0c9a"}, + {file = "mypy-1.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:920169f0184215eef19294fa86ea49ffd4635dedfdea2b57e45cb4ee85d5ccaf"}, + {file = "mypy-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27a0f74a298769d9fdc8498fcb4f2beb86f0564bcdb1a37b58cbbe78e55cf8c0"}, + {file = "mypy-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:65b122a993d9c81ea0bfde7689b3365318a88bde952e4dfa1b3a8b4ac05d168b"}, + {file = "mypy-1.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:5deb252fd42a77add936b463033a59b8e48eb2eaec2976d76b6878d031933fe4"}, + {file = "mypy-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2013226d17f20468f34feddd6aae4635a55f79626549099354ce641bc7d40262"}, + {file = "mypy-1.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:48525aec92b47baed9b3380371ab8ab6e63a5aab317347dfe9e55e02aaad22e8"}, + {file = "mypy-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c96b8a0c019fe29040d520d9257d8c8f122a7343a8307bf8d6d4a43f5c5bfcc8"}, + {file = "mypy-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:448de661536d270ce04f2d7dddaa49b2fdba6e3bd8a83212164d4174ff43aa65"}, + {file = "mypy-1.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:d42a98e76070a365a1d1c220fcac8aa4ada12ae0db679cb4d910fabefc88b994"}, + {file = "mypy-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e64f48c6176e243ad015e995de05af7f22bbe370dbb5b32bd6988438ec873919"}, + {file = "mypy-1.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fdd63e4f50e3538617887e9aee91855368d9fc1dea30da743837b0df7373bc4"}, + {file = "mypy-1.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:dbeb24514c4acbc78d205f85dd0e800f34062efcc1f4a4857c57e4b4b8712bff"}, + {file = "mypy-1.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a2948c40a7dd46c1c33765718936669dc1f628f134013b02ff5ac6c7ef6942bf"}, + {file = "mypy-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5bc8d6bd3b274dd3846597855d96d38d947aedba18776aa998a8d46fabdaed76"}, + {file = "mypy-1.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:17455cda53eeee0a4adb6371a21dd3dbf465897de82843751cf822605d152c8c"}, + {file = "mypy-1.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e831662208055b006eef68392a768ff83596035ffd6d846786578ba1714ba8f6"}, + {file = "mypy-1.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e60d0b09f62ae97a94605c3f73fd952395286cf3e3b9e7b97f60b01ddfbbda88"}, + {file = "mypy-1.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:0af4f0e20706aadf4e6f8f8dc5ab739089146b83fd53cb4a7e0e850ef3de0bb6"}, + {file = "mypy-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:24189f23dc66f83b839bd1cce2dfc356020dfc9a8bae03978477b15be61b062e"}, + {file = "mypy-1.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:93a85495fb13dc484251b4c1fd7a5ac370cd0d812bbfc3b39c1bafefe95275d5"}, + {file = "mypy-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f546ac34093c6ce33f6278f7c88f0f147a4849386d3bf3ae193702f4fe31407"}, + {file = "mypy-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c6c2ccb7af7154673c591189c3687b013122c5a891bb5651eca3db8e6c6c55bd"}, + {file = "mypy-1.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:15b5a824b58c7c822c51bc66308e759243c32631896743f030daf449fe3677f3"}, + {file = "mypy-1.0.1-py3-none-any.whl", hash = "sha256:eda5c8b9949ed411ff752b9a01adda31afe7eae1e53e946dbdf9db23865e66c4"}, + {file = "mypy-1.0.1.tar.gz", hash = "sha256:28cea5a6392bb43d266782983b5a4216c25544cd7d80be681a155ddcdafd152d"}, ] [package.dependencies] mypy-extensions = ">=0.4.3" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} typing-extensions = ">=3.10" [package.extras] dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] python2 = ["typed-ast (>=1.4.0,<2)"] reports = ["lxml"] @@ -228,165 +209,148 @@ files = [ [[package]] name = "packaging" -version = "24.0" +version = "24.1" description = "Core utilities for Python packages" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, - {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, ] [[package]] name = "pluggy" -version = "1.2.0" +version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, - {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] name = "pydantic" -version = "2.4.2" +version = "2.8.2" description = "Data validation using Python type hints" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pydantic-2.4.2-py3-none-any.whl", hash = "sha256:bc3ddf669d234f4220e6e1c4d96b061abe0998185a8d7855c0126782b7abc8c1"}, - {file = "pydantic-2.4.2.tar.gz", hash = "sha256:94f336138093a5d7f426aac732dcfe7ab4eb4da243c88f891d65deb4a2556ee7"}, + {file = "pydantic-2.8.2-py3-none-any.whl", hash = "sha256:73ee9fddd406dc318b885c7a2eab8a6472b68b8fb5ba8150949fc3db939f23c8"}, + {file = "pydantic-2.8.2.tar.gz", hash = "sha256:6f62c13d067b0755ad1c21a34bdd06c0c12625a22b0fc09c6b149816604f7c2a"}, ] [package.dependencies] annotated-types = ">=0.4.0" -pydantic-core = "2.10.1" -typing-extensions = ">=4.6.1" +pydantic-core = "2.20.1" +typing-extensions = [ + {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, + {version = ">=4.6.1", markers = "python_version < \"3.13\""}, +] [package.extras] email = ["email-validator (>=2.0.0)"] [[package]] name = "pydantic-core" -version = "2.10.1" -description = "" +version = "2.20.1" +description = "Core functionality for Pydantic validation and serialization" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.10.1-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:d64728ee14e667ba27c66314b7d880b8eeb050e58ffc5fec3b7a109f8cddbd63"}, - {file = "pydantic_core-2.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:48525933fea744a3e7464c19bfede85df4aba79ce90c60b94d8b6e1eddd67096"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ef337945bbd76cce390d1b2496ccf9f90b1c1242a3a7bc242ca4a9fc5993427a"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1392e0638af203cee360495fd2cfdd6054711f2db5175b6e9c3c461b76f5175"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0675ba5d22de54d07bccde38997e780044dcfa9a71aac9fd7d4d7a1d2e3e65f7"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:128552af70a64660f21cb0eb4876cbdadf1a1f9d5de820fed6421fa8de07c893"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f6e6aed5818c264412ac0598b581a002a9f050cb2637a84979859e70197aa9e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ecaac27da855b8d73f92123e5f03612b04c5632fd0a476e469dfc47cd37d6b2e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b3c01c2fb081fced3bbb3da78510693dc7121bb893a1f0f5f4b48013201f362e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:92f675fefa977625105708492850bcbc1182bfc3e997f8eecb866d1927c98ae6"}, - {file = "pydantic_core-2.10.1-cp310-none-win32.whl", hash = "sha256:420a692b547736a8d8703c39ea935ab5d8f0d2573f8f123b0a294e49a73f214b"}, - {file = "pydantic_core-2.10.1-cp310-none-win_amd64.whl", hash = "sha256:0880e239827b4b5b3e2ce05e6b766a7414e5f5aedc4523be6b68cfbc7f61c5d0"}, - {file = "pydantic_core-2.10.1-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:073d4a470b195d2b2245d0343569aac7e979d3a0dcce6c7d2af6d8a920ad0bea"}, - {file = "pydantic_core-2.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:600d04a7b342363058b9190d4e929a8e2e715c5682a70cc37d5ded1e0dd370b4"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39215d809470f4c8d1881758575b2abfb80174a9e8daf8f33b1d4379357e417c"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eeb3d3d6b399ffe55f9a04e09e635554012f1980696d6b0aca3e6cf42a17a03b"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7a7902bf75779bc12ccfc508bfb7a4c47063f748ea3de87135d433a4cca7a2f"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3625578b6010c65964d177626fde80cf60d7f2e297d56b925cb5cdeda6e9925a"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:caa48fc31fc7243e50188197b5f0c4228956f97b954f76da157aae7f67269ae8"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:07ec6d7d929ae9c68f716195ce15e745b3e8fa122fc67698ac6498d802ed0fa4"}, - {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e6f31a17acede6a8cd1ae2d123ce04d8cca74056c9d456075f4f6f85de055607"}, - {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d8f1ebca515a03e5654f88411420fea6380fc841d1bea08effb28184e3d4899f"}, - {file = "pydantic_core-2.10.1-cp311-none-win32.whl", hash = "sha256:6db2eb9654a85ada248afa5a6db5ff1cf0f7b16043a6b070adc4a5be68c716d6"}, - {file = "pydantic_core-2.10.1-cp311-none-win_amd64.whl", hash = "sha256:4a5be350f922430997f240d25f8219f93b0c81e15f7b30b868b2fddfc2d05f27"}, - {file = "pydantic_core-2.10.1-cp311-none-win_arm64.whl", hash = "sha256:5fdb39f67c779b183b0c853cd6b45f7db84b84e0571b3ef1c89cdb1dfc367325"}, - {file = "pydantic_core-2.10.1-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:b1f22a9ab44de5f082216270552aa54259db20189e68fc12484873d926426921"}, - {file = "pydantic_core-2.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8572cadbf4cfa95fb4187775b5ade2eaa93511f07947b38f4cd67cf10783b118"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db9a28c063c7c00844ae42a80203eb6d2d6bbb97070cfa00194dff40e6f545ab"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e2a35baa428181cb2270a15864ec6286822d3576f2ed0f4cd7f0c1708472aff"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05560ab976012bf40f25d5225a58bfa649bb897b87192a36c6fef1ab132540d7"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d6495008733c7521a89422d7a68efa0a0122c99a5861f06020ef5b1f51f9ba7c"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ac492c686defc8e6133e3a2d9eaf5261b3df26b8ae97450c1647286750b901"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8282bab177a9a3081fd3d0a0175a07a1e2bfb7fcbbd949519ea0980f8a07144d"}, - {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:aafdb89fdeb5fe165043896817eccd6434aee124d5ee9b354f92cd574ba5e78f"}, - {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f6defd966ca3b187ec6c366604e9296f585021d922e666b99c47e78738b5666c"}, - {file = "pydantic_core-2.10.1-cp312-none-win32.whl", hash = "sha256:7c4d1894fe112b0864c1fa75dffa045720a194b227bed12f4be7f6045b25209f"}, - {file = "pydantic_core-2.10.1-cp312-none-win_amd64.whl", hash = "sha256:5994985da903d0b8a08e4935c46ed8daf5be1cf217489e673910951dc533d430"}, - {file = "pydantic_core-2.10.1-cp312-none-win_arm64.whl", hash = "sha256:0d8a8adef23d86d8eceed3e32e9cca8879c7481c183f84ed1a8edc7df073af94"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:9badf8d45171d92387410b04639d73811b785b5161ecadabf056ea14d62d4ede"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:ebedb45b9feb7258fac0a268a3f6bec0a2ea4d9558f3d6f813f02ff3a6dc6698"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfe1090245c078720d250d19cb05d67e21a9cd7c257698ef139bc41cf6c27b4f"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e357571bb0efd65fd55f18db0a2fb0ed89d0bb1d41d906b138f088933ae618bb"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3dcd587b69bbf54fc04ca157c2323b8911033e827fffaecf0cafa5a892a0904"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c120c9ce3b163b985a3b966bb701114beb1da4b0468b9b236fc754783d85aa3"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15d6bca84ffc966cc9976b09a18cf9543ed4d4ecbd97e7086f9ce9327ea48891"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5cabb9710f09d5d2e9e2748c3e3e20d991a4c5f96ed8f1132518f54ab2967221"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:82f55187a5bebae7d81d35b1e9aaea5e169d44819789837cdd4720d768c55d15"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:1d40f55222b233e98e3921df7811c27567f0e1a4411b93d4c5c0f4ce131bc42f"}, - {file = "pydantic_core-2.10.1-cp37-none-win32.whl", hash = "sha256:14e09ff0b8fe6e46b93d36a878f6e4a3a98ba5303c76bb8e716f4878a3bee92c"}, - {file = "pydantic_core-2.10.1-cp37-none-win_amd64.whl", hash = "sha256:1396e81b83516b9d5c9e26a924fa69164156c148c717131f54f586485ac3c15e"}, - {file = "pydantic_core-2.10.1-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:6835451b57c1b467b95ffb03a38bb75b52fb4dc2762bb1d9dbed8de31ea7d0fc"}, - {file = "pydantic_core-2.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b00bc4619f60c853556b35f83731bd817f989cba3e97dc792bb8c97941b8053a"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fa467fd300a6f046bdb248d40cd015b21b7576c168a6bb20aa22e595c8ffcdd"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d99277877daf2efe074eae6338453a4ed54a2d93fb4678ddfe1209a0c93a2468"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fa7db7558607afeccb33c0e4bf1c9a9a835e26599e76af6fe2fcea45904083a6"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aad7bd686363d1ce4ee930ad39f14e1673248373f4a9d74d2b9554f06199fb58"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:443fed67d33aa85357464f297e3d26e570267d1af6fef1c21ca50921d2976302"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:042462d8d6ba707fd3ce9649e7bf268633a41018d6a998fb5fbacb7e928a183e"}, - {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ecdbde46235f3d560b18be0cb706c8e8ad1b965e5c13bbba7450c86064e96561"}, - {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ed550ed05540c03f0e69e6d74ad58d026de61b9eaebebbaaf8873e585cbb18de"}, - {file = "pydantic_core-2.10.1-cp38-none-win32.whl", hash = "sha256:8cdbbd92154db2fec4ec973d45c565e767ddc20aa6dbaf50142676484cbff8ee"}, - {file = "pydantic_core-2.10.1-cp38-none-win_amd64.whl", hash = "sha256:9f6f3e2598604956480f6c8aa24a3384dbf6509fe995d97f6ca6103bb8c2534e"}, - {file = "pydantic_core-2.10.1-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:655f8f4c8d6a5963c9a0687793da37b9b681d9ad06f29438a3b2326d4e6b7970"}, - {file = "pydantic_core-2.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e570ffeb2170e116a5b17e83f19911020ac79d19c96f320cbfa1fa96b470185b"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64322bfa13e44c6c30c518729ef08fda6026b96d5c0be724b3c4ae4da939f875"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:485a91abe3a07c3a8d1e082ba29254eea3e2bb13cbbd4351ea4e5a21912cc9b0"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7c2b8eb9fc872e68b46eeaf835e86bccc3a58ba57d0eedc109cbb14177be531"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a5cb87bdc2e5f620693148b5f8f842d293cae46c5f15a1b1bf7ceeed324a740c"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:25bd966103890ccfa028841a8f30cebcf5875eeac8c4bde4fe221364c92f0c9a"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f323306d0556351735b54acbf82904fe30a27b6a7147153cbe6e19aaaa2aa429"}, - {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0c27f38dc4fbf07b358b2bc90edf35e82d1703e22ff2efa4af4ad5de1b3833e7"}, - {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f1365e032a477c1430cfe0cf2856679529a2331426f8081172c4a74186f1d595"}, - {file = "pydantic_core-2.10.1-cp39-none-win32.whl", hash = "sha256:a1c311fd06ab3b10805abb72109f01a134019739bd3286b8ae1bc2fc4e50c07a"}, - {file = "pydantic_core-2.10.1-cp39-none-win_amd64.whl", hash = "sha256:ae8a8843b11dc0b03b57b52793e391f0122e740de3df1474814c700d2622950a"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d43002441932f9a9ea5d6f9efaa2e21458221a3a4b417a14027a1d530201ef1b"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fcb83175cc4936a5425dde3356f079ae03c0802bbdf8ff82c035f8a54b333521"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:962ed72424bf1f72334e2f1e61b68f16c0e596f024ca7ac5daf229f7c26e4208"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2cf5bb4dd67f20f3bbc1209ef572a259027c49e5ff694fa56bed62959b41e1f9"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e544246b859f17373bed915182ab841b80849ed9cf23f1f07b73b7c58baee5fb"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c0877239307b7e69d025b73774e88e86ce82f6ba6adf98f41069d5b0b78bd1bf"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:53df009d1e1ba40f696f8995683e067e3967101d4bb4ea6f667931b7d4a01357"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a1254357f7e4c82e77c348dabf2d55f1d14d19d91ff025004775e70a6ef40ada"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:524ff0ca3baea164d6d93a32c58ac79eca9f6cf713586fdc0adb66a8cdeab96a"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f0ac9fb8608dbc6eaf17956bf623c9119b4db7dbb511650910a82e261e6600f"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:320f14bd4542a04ab23747ff2c8a778bde727158b606e2661349557f0770711e"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:63974d168b6233b4ed6a0046296803cb13c56637a7b8106564ab575926572a55"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:417243bf599ba1f1fef2bb8c543ceb918676954734e2dcb82bf162ae9d7bd514"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dda81e5ec82485155a19d9624cfcca9be88a405e2857354e5b089c2a982144b2"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:14cfbb00959259e15d684505263d5a21732b31248a5dd4941f73a3be233865b9"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:631cb7415225954fdcc2a024119101946793e5923f6c4d73a5914d27eb3d3a05"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:bec7dd208a4182e99c5b6c501ce0b1f49de2802448d4056091f8e630b28e9a52"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:149b8a07712f45b332faee1a2258d8ef1fb4a36f88c0c17cb687f205c5dc6e7d"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4d966c47f9dd73c2d32a809d2be529112d509321c5310ebf54076812e6ecd884"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7eb037106f5c6b3b0b864ad226b0b7ab58157124161d48e4b30c4a43fef8bc4b"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:154ea7c52e32dce13065dbb20a4a6f0cc012b4f667ac90d648d36b12007fa9f7"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e562617a45b5a9da5be4abe72b971d4f00bf8555eb29bb91ec2ef2be348cd132"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:f23b55eb5464468f9e0e9a9935ce3ed2a870608d5f534025cd5536bca25b1402"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:e9121b4009339b0f751955baf4543a0bfd6bc3f8188f8056b1a25a2d45099934"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:0523aeb76e03f753b58be33b26540880bac5aa54422e4462404c432230543f33"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e0e2959ef5d5b8dc9ef21e1a305a21a36e254e6a34432d00c72a92fdc5ecda5"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:da01bec0a26befab4898ed83b362993c844b9a607a86add78604186297eb047e"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f2e9072d71c1f6cfc79a36d4484c82823c560e6f5599c43c1ca6b5cdbd54f881"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:f36a3489d9e28fe4b67be9992a23029c3cec0babc3bd9afb39f49844a8c721c5"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f64f82cc3443149292b32387086d02a6c7fb39b8781563e0ca7b8d7d9cf72bd7"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:b4a6db486ac8e99ae696e09efc8b2b9fea67b63c8f88ba7a1a16c24a057a0776"}, - {file = "pydantic_core-2.10.1.tar.gz", hash = "sha256:0f8682dbdd2f67f8e1edddcbffcc29f60a6182b4901c367fc8c1c40d30bb0a82"}, + {file = "pydantic_core-2.20.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3acae97ffd19bf091c72df4d726d552c473f3576409b2a7ca36b2f535ffff4a3"}, + {file = "pydantic_core-2.20.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:41f4c96227a67a013e7de5ff8f20fb496ce573893b7f4f2707d065907bffdbd6"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f239eb799a2081495ea659d8d4a43a8f42cd1fe9ff2e7e436295c38a10c286a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:53e431da3fc53360db73eedf6f7124d1076e1b4ee4276b36fb25514544ceb4a3"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f1f62b2413c3a0e846c3b838b2ecd6c7a19ec6793b2a522745b0869e37ab5bc1"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5d41e6daee2813ecceea8eda38062d69e280b39df793f5a942fa515b8ed67953"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d482efec8b7dc6bfaedc0f166b2ce349df0011f5d2f1f25537ced4cfc34fd98"}, + {file = "pydantic_core-2.20.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e93e1a4b4b33daed65d781a57a522ff153dcf748dee70b40c7258c5861e1768a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e7c4ea22b6739b162c9ecaaa41d718dfad48a244909fe7ef4b54c0b530effc5a"}, + {file = "pydantic_core-2.20.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4f2790949cf385d985a31984907fecb3896999329103df4e4983a4a41e13e840"}, + {file = "pydantic_core-2.20.1-cp310-none-win32.whl", hash = "sha256:5e999ba8dd90e93d57410c5e67ebb67ffcaadcea0ad973240fdfd3a135506250"}, + {file = "pydantic_core-2.20.1-cp310-none-win_amd64.whl", hash = "sha256:512ecfbefef6dac7bc5eaaf46177b2de58cdf7acac8793fe033b24ece0b9566c"}, + {file = "pydantic_core-2.20.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:d2a8fa9d6d6f891f3deec72f5cc668e6f66b188ab14bb1ab52422fe8e644f312"}, + {file = "pydantic_core-2.20.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:175873691124f3d0da55aeea1d90660a6ea7a3cfea137c38afa0a5ffabe37b88"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37eee5b638f0e0dcd18d21f59b679686bbd18917b87db0193ae36f9c23c355fc"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:25e9185e2d06c16ee438ed39bf62935ec436474a6ac4f9358524220f1b236e43"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:150906b40ff188a3260cbee25380e7494ee85048584998c1e66df0c7a11c17a6"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ad4aeb3e9a97286573c03df758fc7627aecdd02f1da04516a86dc159bf70121"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d3f3ed29cd9f978c604708511a1f9c2fdcb6c38b9aae36a51905b8811ee5cbf1"}, + {file = "pydantic_core-2.20.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b0dae11d8f5ded51699c74d9548dcc5938e0804cc8298ec0aa0da95c21fff57b"}, + {file = "pydantic_core-2.20.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:faa6b09ee09433b87992fb5a2859efd1c264ddc37280d2dd5db502126d0e7f27"}, + {file = "pydantic_core-2.20.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9dc1b507c12eb0481d071f3c1808f0529ad41dc415d0ca11f7ebfc666e66a18b"}, + {file = "pydantic_core-2.20.1-cp311-none-win32.whl", hash = "sha256:fa2fddcb7107e0d1808086ca306dcade7df60a13a6c347a7acf1ec139aa6789a"}, + {file = "pydantic_core-2.20.1-cp311-none-win_amd64.whl", hash = "sha256:40a783fb7ee353c50bd3853e626f15677ea527ae556429453685ae32280c19c2"}, + {file = "pydantic_core-2.20.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:595ba5be69b35777474fa07f80fc260ea71255656191adb22a8c53aba4479231"}, + {file = "pydantic_core-2.20.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a4f55095ad087474999ee28d3398bae183a66be4823f753cd7d67dd0153427c9"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9aa05d09ecf4c75157197f27cdc9cfaeb7c5f15021c6373932bf3e124af029f"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e97fdf088d4b31ff4ba35db26d9cc472ac7ef4a2ff2badeabf8d727b3377fc52"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bc633a9fe1eb87e250b5c57d389cf28998e4292336926b0b6cdaee353f89a237"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d573faf8eb7e6b1cbbcb4f5b247c60ca8be39fe2c674495df0eb4318303137fe"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26dc97754b57d2fd00ac2b24dfa341abffc380b823211994c4efac7f13b9e90e"}, + {file = "pydantic_core-2.20.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:33499e85e739a4b60c9dac710c20a08dc73cb3240c9a0e22325e671b27b70d24"}, + {file = "pydantic_core-2.20.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:bebb4d6715c814597f85297c332297c6ce81e29436125ca59d1159b07f423eb1"}, + {file = "pydantic_core-2.20.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:516d9227919612425c8ef1c9b869bbbee249bc91912c8aaffb66116c0b447ebd"}, + {file = "pydantic_core-2.20.1-cp312-none-win32.whl", hash = "sha256:469f29f9093c9d834432034d33f5fe45699e664f12a13bf38c04967ce233d688"}, + {file = "pydantic_core-2.20.1-cp312-none-win_amd64.whl", hash = "sha256:035ede2e16da7281041f0e626459bcae33ed998cca6a0a007a5ebb73414ac72d"}, + {file = "pydantic_core-2.20.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:0827505a5c87e8aa285dc31e9ec7f4a17c81a813d45f70b1d9164e03a813a686"}, + {file = "pydantic_core-2.20.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:19c0fa39fa154e7e0b7f82f88ef85faa2a4c23cc65aae2f5aea625e3c13c735a"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa223cd1e36b642092c326d694d8bf59b71ddddc94cdb752bbbb1c5c91d833b"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c336a6d235522a62fef872c6295a42ecb0c4e1d0f1a3e500fe949415761b8a19"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7eb6a0587eded33aeefea9f916899d42b1799b7b14b8f8ff2753c0ac1741edac"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:70c8daf4faca8da5a6d655f9af86faf6ec2e1768f4b8b9d0226c02f3d6209703"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e9fa4c9bf273ca41f940bceb86922a7667cd5bf90e95dbb157cbb8441008482c"}, + {file = "pydantic_core-2.20.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:11b71d67b4725e7e2a9f6e9c0ac1239bbc0c48cce3dc59f98635efc57d6dac83"}, + {file = "pydantic_core-2.20.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:270755f15174fb983890c49881e93f8f1b80f0b5e3a3cc1394a255706cabd203"}, + {file = "pydantic_core-2.20.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:c81131869240e3e568916ef4c307f8b99583efaa60a8112ef27a366eefba8ef0"}, + {file = "pydantic_core-2.20.1-cp313-none-win32.whl", hash = "sha256:b91ced227c41aa29c672814f50dbb05ec93536abf8f43cd14ec9521ea09afe4e"}, + {file = "pydantic_core-2.20.1-cp313-none-win_amd64.whl", hash = "sha256:65db0f2eefcaad1a3950f498aabb4875c8890438bc80b19362cf633b87a8ab20"}, + {file = "pydantic_core-2.20.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:4745f4ac52cc6686390c40eaa01d48b18997cb130833154801a442323cc78f91"}, + {file = "pydantic_core-2.20.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a8ad4c766d3f33ba8fd692f9aa297c9058970530a32c728a2c4bfd2616d3358b"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41e81317dd6a0127cabce83c0c9c3fbecceae981c8391e6f1dec88a77c8a569a"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:04024d270cf63f586ad41fff13fde4311c4fc13ea74676962c876d9577bcc78f"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:eaad4ff2de1c3823fddf82f41121bdf453d922e9a238642b1dedb33c4e4f98ad"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:26ab812fa0c845df815e506be30337e2df27e88399b985d0bb4e3ecfe72df31c"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c5ebac750d9d5f2706654c638c041635c385596caf68f81342011ddfa1e5598"}, + {file = "pydantic_core-2.20.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2aafc5a503855ea5885559eae883978c9b6d8c8993d67766ee73d82e841300dd"}, + {file = "pydantic_core-2.20.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:4868f6bd7c9d98904b748a2653031fc9c2f85b6237009d475b1008bfaeb0a5aa"}, + {file = "pydantic_core-2.20.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:aa2f457b4af386254372dfa78a2eda2563680d982422641a85f271c859df1987"}, + {file = "pydantic_core-2.20.1-cp38-none-win32.whl", hash = "sha256:225b67a1f6d602de0ce7f6c1c3ae89a4aa25d3de9be857999e9124f15dab486a"}, + {file = "pydantic_core-2.20.1-cp38-none-win_amd64.whl", hash = "sha256:6b507132dcfc0dea440cce23ee2182c0ce7aba7054576efc65634f080dbe9434"}, + {file = "pydantic_core-2.20.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:b03f7941783b4c4a26051846dea594628b38f6940a2fdc0df00b221aed39314c"}, + {file = "pydantic_core-2.20.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1eedfeb6089ed3fad42e81a67755846ad4dcc14d73698c120a82e4ccf0f1f9f6"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:635fee4e041ab9c479e31edda27fcf966ea9614fff1317e280d99eb3e5ab6fe2"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:77bf3ac639c1ff567ae3b47f8d4cc3dc20f9966a2a6dd2311dcc055d3d04fb8a"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ed1b0132f24beeec5a78b67d9388656d03e6a7c837394f99257e2d55b461611"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c6514f963b023aeee506678a1cf821fe31159b925c4b76fe2afa94cc70b3222b"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10d4204d8ca33146e761c79f83cc861df20e7ae9f6487ca290a97702daf56006"}, + {file = "pydantic_core-2.20.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2d036c7187b9422ae5b262badb87a20a49eb6c5238b2004e96d4da1231badef1"}, + {file = "pydantic_core-2.20.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9ebfef07dbe1d93efb94b4700f2d278494e9162565a54f124c404a5656d7ff09"}, + {file = "pydantic_core-2.20.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6b9d9bb600328a1ce523ab4f454859e9d439150abb0906c5a1983c146580ebab"}, + {file = "pydantic_core-2.20.1-cp39-none-win32.whl", hash = "sha256:784c1214cb6dd1e3b15dd8b91b9a53852aed16671cc3fbe4786f4f1db07089e2"}, + {file = "pydantic_core-2.20.1-cp39-none-win_amd64.whl", hash = "sha256:d2fe69c5434391727efa54b47a1e7986bb0186e72a41b203df8f5b0a19a4f669"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:a45f84b09ac9c3d35dfcf6a27fd0634d30d183205230a0ebe8373a0e8cfa0906"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d02a72df14dfdbaf228424573a07af10637bd490f0901cee872c4f434a735b94"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2b27e6af28f07e2f195552b37d7d66b150adbaa39a6d327766ffd695799780f"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:084659fac3c83fd674596612aeff6041a18402f1e1bc19ca39e417d554468482"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:242b8feb3c493ab78be289c034a1f659e8826e2233786e36f2893a950a719bb6"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:38cf1c40a921d05c5edc61a785c0ddb4bed67827069f535d794ce6bcded919fc"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e0bbdd76ce9aa5d4209d65f2b27fc6e5ef1312ae6c5333c26db3f5ade53a1e99"}, + {file = "pydantic_core-2.20.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:254ec27fdb5b1ee60684f91683be95e5133c994cc54e86a0b0963afa25c8f8a6"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:407653af5617f0757261ae249d3fba09504d7a71ab36ac057c938572d1bc9331"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:c693e916709c2465b02ca0ad7b387c4f8423d1db7b4649c551f27a529181c5ad"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b5ff4911aea936a47d9376fd3ab17e970cc543d1b68921886e7f64bd28308d1"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:177f55a886d74f1808763976ac4efd29b7ed15c69f4d838bbd74d9d09cf6fa86"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:964faa8a861d2664f0c7ab0c181af0bea66098b1919439815ca8803ef136fc4e"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:4dd484681c15e6b9a977c785a345d3e378d72678fd5f1f3c0509608da24f2ac0"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f6d6cff3538391e8486a431569b77921adfcdef14eb18fbf19b7c0a5294d4e6a"}, + {file = "pydantic_core-2.20.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a6d511cc297ff0883bc3708b465ff82d7560193169a8b93260f74ecb0a5e08a7"}, + {file = "pydantic_core-2.20.1.tar.gz", hash = "sha256:26ca695eeee5f9f1aeeb211ffc12f10bcb6f71e2989988fda61dabd65db878d4"}, ] [package.dependencies] @@ -406,7 +370,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -415,6 +378,76 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "pytest-asyncio" +version = "0.23.8" +description = "Pytest support for asyncio" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"}, + {file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"}, +] + +[package.dependencies] +pytest = ">=7.0.0,<9" + +[package.extras] +docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] +testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"] + +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "ruff" +version = "0.5.7" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.5.7-py3-none-linux_armv6l.whl", hash = "sha256:548992d342fc404ee2e15a242cdbea4f8e39a52f2e7752d0e4cbe88d2d2f416a"}, + {file = "ruff-0.5.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00cc8872331055ee017c4f1071a8a31ca0809ccc0657da1d154a1d2abac5c0be"}, + {file = "ruff-0.5.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eaf3d86a1fdac1aec8a3417a63587d93f906c678bb9ed0b796da7b59c1114a1e"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a01c34400097b06cf8a6e61b35d6d456d5bd1ae6961542de18ec81eaf33b4cb8"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcc8054f1a717e2213500edaddcf1dbb0abad40d98e1bd9d0ad364f75c763eea"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f70284e73f36558ef51602254451e50dd6cc479f8b6f8413a95fcb5db4a55fc"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a78ad870ae3c460394fc95437d43deb5c04b5c29297815a2a1de028903f19692"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ccd078c66a8e419475174bfe60a69adb36ce04f8d4e91b006f1329d5cd44bcf"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e31c9bad4ebf8fdb77b59cae75814440731060a09a0e0077d559a556453acbb"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d796327eed8e168164346b769dd9a27a70e0298d667b4ecee6877ce8095ec8e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a09ea2c3f7778cc635e7f6edf57d566a8ee8f485f3c4454db7771efb692c499"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a36d8dcf55b3a3bc353270d544fb170d75d2dff41eba5df57b4e0b67a95bb64e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9369c218f789eefbd1b8d82a8cf25017b523ac47d96b2f531eba73770971c9e5"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b88ca3db7eb377eb24fb7c82840546fb7acef75af4a74bd36e9ceb37a890257e"}, + {file = "ruff-0.5.7-py3-none-win32.whl", hash = "sha256:33d61fc0e902198a3e55719f4be6b375b28f860b09c281e4bdbf783c0566576a"}, + {file = "ruff-0.5.7-py3-none-win_amd64.whl", hash = "sha256:083bbcbe6fadb93cd86709037acc510f86eed5a314203079df174c40bbbca6b3"}, + {file = "ruff-0.5.7-py3-none-win_arm64.whl", hash = "sha256:2dca26154ff9571995107221d0aeaad0e75a77b5a682d6236cf89a58c70b76f4"}, + {file = "ruff-0.5.7.tar.gz", hash = "sha256:8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5"}, +] + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + [[package]] name = "sniffio" version = "1.3.1" @@ -438,82 +471,28 @@ files = [ ] [[package]] -name = "typed-ast" -version = "1.5.5" -description = "a fork of Python 2 and 3 ast modules with type comment support" +name = "types-python-dateutil" +version = "2.9.0.20240316" +description = "Typing stubs for python-dateutil" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, - {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, - {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, - {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, - {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, - {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, - {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, - {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, - {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, - {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, - {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, + {file = "types-python-dateutil-2.9.0.20240316.tar.gz", hash = "sha256:5d2f2e240b86905e40944dd787db6da9263f0deabef1076ddaed797351ec0202"}, + {file = "types_python_dateutil-2.9.0.20240316-py3-none-any.whl", hash = "sha256:6b8cb66d960771ce5ff974e9dd45e38facb81718cc1e208b10b1baccbfdbee3b"}, ] [[package]] name = "typing-extensions" -version = "4.7.1" -description = "Backported and Experimental Type Hints for Python 3.7+" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, - {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] -[[package]] -name = "zipp" -version = "3.15.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.7" -files = [ - {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, - {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] - [metadata] lock-version = "2.0" -python-versions = "^3.7" -content-hash = "4ac84aae6b05a415337279868d39fe7ce44104dffcd6b159af9e12dcea350ba1" +python-versions = "^3.8" +content-hash = "6f6c191c1028d17a97fdfa84cedfd3cef94b5d63d98b8c1d333b3398eeea9055" diff --git a/pyproject.toml b/pyproject.toml index 10b9b6e..58c6d0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,60 @@ [tool.poetry] name = "vocode-api" -version = "0.0.46" +version = "0.0.47" description = "" readme = "README.md" authors = [] +keywords = [] + +classifiers = [ + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Topic :: Software Development :: Libraries :: Python Modules", + "Typing :: Typed" +] packages = [ { include = "vocode", from = "src"} ] +[project.urls] +Repository = 'https://github.com/vocodedev/vocode-api-python' + [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" httpx = ">=0.21.2" -pydantic = ">= 1.9.2, < 2.5.0" +pydantic = ">= 1.9.2" +pydantic-core = "^2.18.2" +typing_extensions = ">= 4.0.0" [tool.poetry.dev-dependencies] -mypy = "0.971" +mypy = "1.0.1" pytest = "^7.4.0" +pytest-asyncio = "^0.23.5" +python-dateutil = "^2.9.0" +types-python-dateutil = "^2.9.0.20240316" +ruff = "^0.5.6" + +[tool.pytest.ini_options] +testpaths = [ "tests" ] +asyncio_mode = "auto" + +[tool.mypy] +plugins = ["pydantic.mypy"] + +[tool.ruff] +line-length = 120 + [build-system] requires = ["poetry-core"] diff --git a/reference.md b/reference.md new file mode 100644 index 0000000..c67b44d --- /dev/null +++ b/reference.md @@ -0,0 +1,3278 @@ +# Reference +
client.metrics_metrics_get() +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Endpoint that serves Prometheus metrics. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.metrics_metrics_get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## numbers +
client.numbers.list_numbers(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.list_numbers() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.numbers.get_number(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.get_number( + phone_number="phone_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.numbers.buy_number(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.buy_number() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**area_code:** `typing.Optional[str]` + +
+
+ +
+
+ +**telephony_provider:** `typing.Optional[BuyPhoneNumberRequestTelephonyProvider]` + +
+
+ +
+
+ +**telephony_account_connection:** `typing.Optional[str]` + +
+
+ +
+
+ +**inbound_agent:** `typing.Optional[BuyPhoneNumberRequestInboundAgent]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.numbers.update_number(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.update_number( + phone_number="phone_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number:** `str` + +
+
+ +
+
+ +**outbound_only:** `typing.Optional[UpdateNumberRequestOutboundOnly]` + +
+
+ +
+
+ +**example_context:** `typing.Optional[UpdateNumberRequestExampleContext]` + +
+
+ +
+
+ +**label:** `typing.Optional[UpdateNumberRequestLabel]` + +
+
+ +
+
+ +**inbound_agent:** `typing.Optional[UpdateNumberRequestInboundAgent]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.numbers.cancel_number(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.cancel_number( + phone_number="phone_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.numbers.link_number(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.numbers.link_number( + phone_number="phone_number", + telephony_account_connection="telephony_account_connection", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number:** `str` + +
+
+ +
+
+ +**telephony_account_connection:** `str` + +
+
+ +
+
+ +**outbound_only:** `typing.Optional[bool]` + +
+
+ +
+
+ +**inbound_agent:** `typing.Optional[LinkPhoneNumberRequestInboundAgent]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## calls +
client.calls.list_calls(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.calls.list_calls() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.calls.get_call(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.calls.get_call( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.calls.end_call(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.calls.end_call( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.calls.create_call(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.calls.create_call( + from_number="from_number", + to_number="to_number", + agent="agent", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**from_number:** `str` + +
+
+ +
+
+ +**to_number:** `str` + +
+
+ +
+
+ +**agent:** `CreateCallRequestAgent` + +
+
+ +
+
+ +**on_no_human_answer:** `typing.Optional[CreateCallRequestOnNoHumanAnswer]` + +
+
+ +
+
+ +**run_do_not_call_detection:** `typing.Optional[bool]` + +
+
+ +
+
+ +**hipaa_compliant:** `typing.Optional[bool]` + +
+
+ +
+
+ +**context:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` + +
+
+ +
+
+ +**telephony_params:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.calls.get_recording(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.calls.get_recording( + id="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Usage +
client.usage.get_usage() +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.usage.get_usage() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Actions +
client.actions.get_action(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.actions.get_action( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.actions.list_actions(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.actions.list_actions() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.actions.create_action(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import AddToConferenceActionParams, AddToConferenceConfig, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.actions.create_action( + request=AddToConferenceActionParams( + config=AddToConferenceConfig( + phone_number="phone_number", + ), + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ActionParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.actions.update_action(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import AddToConferenceActionUpdateParams, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.actions.update_action( + id="id", + request=AddToConferenceActionUpdateParams(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request:** `ActionUpdateParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Agents +
client.agents.get_agent(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.agents.get_agent( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.agents.list_agents(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.agents.list_agents() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.agents.create_agent(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.agents.create_agent( + prompt="prompt", + voice="voice", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt:** `AgentParamsPrompt` + +
+
+ +
+
+ +**voice:** `AgentParamsVoice` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**language:** `typing.Optional[Language]` + +
+
+ +
+
+ +**actions:** `typing.Optional[typing.Sequence[AgentParamsActionsItem]]` + +
+
+ +
+
+ +**initial_message:** `typing.Optional[str]` + +
+
+ +
+
+ +**webhook:** `typing.Optional[AgentParamsWebhook]` + +
+
+ +
+
+ +**vector_database:** `typing.Optional[AgentParamsVectorDatabase]` + +
+
+ +
+
+ +**interrupt_sensitivity:** `typing.Optional[InterruptSensitivity]` + +
+
+ +
+
+ +**context_endpoint:** `typing.Optional[str]` + +
+
+ +
+
+ +**noise_suppression:** `typing.Optional[bool]` + +
+
+ +
+
+ +**endpointing_sensitivity:** `typing.Optional[AgentParamsEndpointingSensitivity]` + +
+
+ +
+
+ +**ivr_navigation_mode:** `typing.Optional[AgentParamsIvrNavigationMode]` + +
+
+ +
+
+ +**conversation_speed:** `typing.Optional[float]` + +
+
+ +
+
+ +**initial_message_delay:** `typing.Optional[float]` + +
+
+ +
+
+ +**openai_model_name_override:** `typing.Optional[str]` + +
+
+ +
+
+ +**ask_if_human_present_on_idle:** `typing.Optional[bool]` + +
+
+ +
+
+ +**openai_account_connection:** `typing.Optional[AgentParamsOpenaiAccountConnection]` + +
+
+ +
+
+ +**run_do_not_call_detection:** `typing.Optional[bool]` + +
+
+ +
+
+ +**llm_fallback:** `typing.Optional[InternalLlmFallback]` + +
+
+ +
+
+ +**deepgram_keywords:** `typing.Optional[ + typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]] +]` + +
+
+ +
+
+ +**llm_temperature:** `typing.Optional[float]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.agents.update_agent(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.agents.update_agent( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**name:** `typing.Optional[AgentUpdateParamsName]` + +
+
+ +
+
+ +**prompt:** `typing.Optional[AgentUpdateParamsPrompt]` + +
+
+ +
+
+ +**language:** `typing.Optional[AgentUpdateParamsLanguage]` + +
+
+ +
+
+ +**actions:** `typing.Optional[AgentUpdateParamsActions]` + +
+
+ +
+
+ +**voice:** `typing.Optional[AgentUpdateParamsVoice]` + +
+
+ +
+
+ +**initial_message:** `typing.Optional[AgentUpdateParamsInitialMessage]` + +
+
+ +
+
+ +**webhook:** `typing.Optional[AgentUpdateParamsWebhook]` + +
+
+ +
+
+ +**vector_database:** `typing.Optional[AgentUpdateParamsVectorDatabase]` + +
+
+ +
+
+ +**interrupt_sensitivity:** `typing.Optional[AgentUpdateParamsInterruptSensitivity]` + +
+
+ +
+
+ +**context_endpoint:** `typing.Optional[AgentUpdateParamsContextEndpoint]` + +
+
+ +
+
+ +**noise_suppression:** `typing.Optional[AgentUpdateParamsNoiseSuppression]` + +
+
+ +
+
+ +**endpointing_sensitivity:** `typing.Optional[AgentUpdateParamsEndpointingSensitivity]` + +
+
+ +
+
+ +**ivr_navigation_mode:** `typing.Optional[AgentUpdateParamsIvrNavigationMode]` + +
+
+ +
+
+ +**conversation_speed:** `typing.Optional[AgentUpdateParamsConversationSpeed]` + +
+
+ +
+
+ +**initial_message_delay:** `typing.Optional[AgentUpdateParamsInitialMessageDelay]` + +
+
+ +
+
+ +**openai_model_name_override:** `typing.Optional[AgentUpdateParamsOpenaiModelNameOverride]` + +
+
+ +
+
+ +**ask_if_human_present_on_idle:** `typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle]` + +
+
+ +
+
+ +**openai_account_connection:** `typing.Optional[AgentUpdateParamsOpenaiAccountConnection]` + +
+
+ +
+
+ +**run_do_not_call_detection:** `typing.Optional[AgentUpdateParamsRunDoNotCallDetection]` + +
+
+ +
+
+ +**llm_fallback:** `typing.Optional[AgentUpdateParamsLlmFallback]` + +
+
+ +
+
+ +**deepgram_keywords:** `typing.Optional[AgentUpdateParamsDeepgramKeywords]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices +
client.voices.get_voice(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.voices.get_voice( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.list_voices(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.voices.list_voices() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.create_voice(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import AzureVoiceParams, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.voices.create_voice( + request=AzureVoiceParams( + voice_name="voice_name", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `VoiceParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.update_voice(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import AzureVoiceUpdateParams, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.voices.update_voice( + id="id", + request=AzureVoiceUpdateParams(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request:** `VoiceUpdateParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Webhooks +
client.webhooks.get_webhook(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.webhooks.get_webhook( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.list_webhooks(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.webhooks.list_webhooks() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.create_webhook(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.webhooks.create_webhook( + subscriptions=["event_message"], + url="url", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**subscriptions:** `typing.Sequence[EventType]` + +
+
+ +
+
+ +**url:** `str` + +
+
+ +
+
+ +**method:** `typing.Optional[HttpMethod]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.update_webhook(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.webhooks.update_webhook( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**subscriptions:** `typing.Optional[WebhookUpdateParamsSubscriptions]` + +
+
+ +
+
+ +**url:** `typing.Optional[WebhookUpdateParamsUrl]` + +
+
+ +
+
+ +**method:** `typing.Optional[WebhookUpdateParamsMethod]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Prompts +
client.prompts.get_prompt(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.prompts.get_prompt( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.prompts.list_prompts(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.prompts.list_prompts() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.prompts.create_prompt(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.prompts.create_prompt() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**content:** `typing.Optional[str]` + +
+
+ +
+
+ +**collect_fields:** `typing.Optional[typing.Sequence[CollectField]]` + +
+
+ +
+
+ +**context_endpoint:** `typing.Optional[str]` + +
+
+ +
+
+ +**prompt_template:** `typing.Optional[PromptParamsPromptTemplate]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.prompts.update_prompt(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.prompts.update_prompt( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**content:** `typing.Optional[PromptUpdateParamsContent]` + +
+
+ +
+
+ +**collect_fields:** `typing.Optional[PromptUpdateParamsCollectFields]` + +
+
+ +
+
+ +**context_endpoint:** `typing.Optional[PromptUpdateParamsContextEndpoint]` + +
+
+ +
+
+ +**prompt_template:** `typing.Optional[PromptUpdateParamsPromptTemplate]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## VectorDatabases +
client.vector_databases.get_vector_database(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.vector_databases.get_vector_database( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.vector_databases.list_vector_databases(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.vector_databases.list_vector_databases() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.vector_databases.create_vector_database(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.vector_databases.create_vector_database( + index="index", + api_key="api_key", + api_environment="api_environment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**index:** `str` + +
+
+ +
+
+ +**api_key:** `str` + +
+
+ +
+
+ +**api_environment:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.vector_databases.update_vector_database(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.vector_databases.update_vector_database( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**index:** `typing.Optional[PineconeVectorDatabaseUpdateParamsIndex]` + +
+
+ +
+
+ +**api_key:** `typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey]` + +
+
+ +
+
+ +**api_environment:** `typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## AccountConnections +
client.account_connections.get_account_connection(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.get_account_connection( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.account_connections.list_account_connections(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.list_account_connections() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**size:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort_column:** `typing.Optional[str]` + +
+
+ +
+
+ +**sort_desc:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.account_connections.create_account_connection(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import OpenAiAccountConnectionParams, OpenAiCredentials, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.create_account_connection( + request=OpenAiAccountConnectionParams( + credentials=OpenAiCredentials( + openai_api_key="openai_api_key", + ), + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `AccountConnectionParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.account_connections.update_account_connection(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import OpenAiAccountConnectionUpdateParams, Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.update_account_connection( + id="id", + request=OpenAiAccountConnectionUpdateParams(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request:** `AccountConnectionUpdateParamsRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.account_connections.add_to_steering_pool(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.add_to_steering_pool( + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request:** `typing.Optional[AddToSteeringPoolBody]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.account_connections.remove_from_steering_pool(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from vocode import Vocode + +client = Vocode( + token="YOUR_TOKEN", +) +client.account_connections.remove_from_steering_pool( + id="id", + phone_number="phone_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**phone_number:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ diff --git a/src/vocode/__init__.py b/src/vocode/__init__.py index f22b147..4c75008 100644 --- a/src/vocode/__init__.py +++ b/src/vocode/__init__.py @@ -3,91 +3,58 @@ from .types import ( AccountConnectionPage, AccountConnectionPageItemsItem, - AccountConnectionPageItemsItem_AccountConnectionOpenai, - AccountConnectionPageItemsItem_AccountConnectionTwilio, AccountConnectionParamsRequest, - AccountConnectionParamsRequest_AccountConnectionOpenai, - AccountConnectionParamsRequest_AccountConnectionTwilio, AccountConnectionResponseModel, - AccountConnectionResponseModel_AccountConnectionOpenai, - AccountConnectionResponseModel_AccountConnectionTwilio, AccountConnectionUpdateParamsRequest, - AccountConnectionUpdateParamsRequest_AccountConnectionOpenai, - AccountConnectionUpdateParamsRequest_AccountConnectionTwilio, ActionPage, ActionPageItemsItem, - ActionPageItemsItem_ActionAddToConference, - ActionPageItemsItem_ActionDtmf, - ActionPageItemsItem_ActionEndConversation, - ActionPageItemsItem_ActionExternal, - ActionPageItemsItem_ActionSetHold, - ActionPageItemsItem_ActionTransferCall, ActionParamsRequest, - ActionParamsRequest_ActionAddToConference, - ActionParamsRequest_ActionDtmf, - ActionParamsRequest_ActionEndConversation, - ActionParamsRequest_ActionExternal, - ActionParamsRequest_ActionSetHold, - ActionParamsRequest_ActionTransferCall, ActionResponseModel, - ActionResponseModel_ActionAddToConference, - ActionResponseModel_ActionDtmf, - ActionResponseModel_ActionEndConversation, - ActionResponseModel_ActionExternal, - ActionResponseModel_ActionSetHold, - ActionResponseModel_ActionTransferCall, ActionUpdateParamsRequest, - ActionUpdateParamsRequest_ActionAddToConference, - ActionUpdateParamsRequest_ActionDtmf, - ActionUpdateParamsRequest_ActionEndConversation, - ActionUpdateParamsRequest_ActionExternal, - ActionUpdateParamsRequest_ActionSetHold, - ActionUpdateParamsRequest_ActionTransferCall, AddToConferenceAction, AddToConferenceActionActionTrigger, - AddToConferenceActionActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionActionTrigger_ActionTriggerPhraseBased, AddToConferenceActionParams, AddToConferenceActionParamsActionTrigger, - AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased, AddToConferenceActionUpdateParams, AddToConferenceActionUpdateParamsActionTrigger, AddToConferenceActionUpdateParamsActionTriggerZero, - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, AddToConferenceActionUpdateParamsConfig, AddToConferenceConfig, + AddToSteeringPoolBody, Agent, AgentActionsItem, - AgentActionsItem_ActionAddToConference, - AgentActionsItem_ActionDtmf, - AgentActionsItem_ActionEndConversation, - AgentActionsItem_ActionExternal, - AgentActionsItem_ActionSetHold, - AgentActionsItem_ActionTransferCall, + AgentDeepgramKeywordsValue, AgentEndpointingSensitivity, AgentIvrNavigationMode, AgentPage, + AgentParams, + AgentParamsActionsItem, + AgentParamsActionsItemOne, + AgentParamsDeepgramKeywordsValue, + AgentParamsEndpointingSensitivity, + AgentParamsIvrNavigationMode, + AgentParamsOpenaiAccountConnection, + AgentParamsPrompt, + AgentParamsVectorDatabase, + AgentParamsVoice, + AgentParamsVoiceOne, + AgentParamsWebhook, AgentUpdateParams, AgentUpdateParamsActions, AgentUpdateParamsActionsItem, AgentUpdateParamsActionsItemOne, - AgentUpdateParamsActionsItemOne_ActionAddToConference, - AgentUpdateParamsActionsItemOne_ActionDtmf, - AgentUpdateParamsActionsItemOne_ActionEndConversation, - AgentUpdateParamsActionsItemOne_ActionExternal, - AgentUpdateParamsActionsItemOne_ActionSetHold, - AgentUpdateParamsActionsItemOne_ActionTransferCall, AgentUpdateParamsAskIfHumanPresentOnIdle, AgentUpdateParamsContextEndpoint, AgentUpdateParamsConversationSpeed, + AgentUpdateParamsDeepgramKeywords, + AgentUpdateParamsDeepgramKeywordsZeroValue, AgentUpdateParamsEndpointingSensitivity, AgentUpdateParamsInitialMessage, AgentUpdateParamsInitialMessageDelay, AgentUpdateParamsInterruptSensitivity, AgentUpdateParamsIvrNavigationMode, AgentUpdateParamsLanguage, + AgentUpdateParamsLlmFallback, AgentUpdateParamsName, AgentUpdateParamsNoiseSuppression, AgentUpdateParamsOpenaiAccountConnection, @@ -97,24 +64,14 @@ AgentUpdateParamsVectorDatabase, AgentUpdateParamsVoice, AgentUpdateParamsVoiceOne, - AgentUpdateParamsVoiceOne_VoiceAzure, - AgentUpdateParamsVoiceOne_VoiceElevenLabs, - AgentUpdateParamsVoiceOne_VoicePlayHt, - AgentUpdateParamsVoiceOne_VoiceRime, AgentUpdateParamsWebhook, AgentVoice, - AgentVoice_VoiceAzure, - AgentVoice_VoiceElevenLabs, - AgentVoice_VoicePlayHt, - AgentVoice_VoiceRime, AzureVoice, AzureVoiceParams, AzureVoiceUpdateParams, AzureVoiceUpdateParamsPitch, AzureVoiceUpdateParamsRate, AzureVoiceUpdateParamsVoiceName, - BuyPhoneNumberRequest, - BuyPhoneNumberRequestTelephonyProvider, Call, CallHumanDetectionResult, CallOnNoHumanAnswer, @@ -123,19 +80,12 @@ CallStageOutcome, CallStatus, CallTelephonyMetadata, - CallTelephonyMetadata_TelephonyMetadataTwilio, - CallTelephonyMetadata_TelephonyMetadataVonage, CallTelephonyProvider, CollectField, CreateCallAgentParams, CreateCallAgentParamsActionsItem, CreateCallAgentParamsActionsItemOne, - CreateCallAgentParamsActionsItemOne_ActionAddToConference, - CreateCallAgentParamsActionsItemOne_ActionDtmf, - CreateCallAgentParamsActionsItemOne_ActionEndConversation, - CreateCallAgentParamsActionsItemOne_ActionExternal, - CreateCallAgentParamsActionsItemOne_ActionSetHold, - CreateCallAgentParamsActionsItemOne_ActionTransferCall, + CreateCallAgentParamsDeepgramKeywordsValue, CreateCallAgentParamsEndpointingSensitivity, CreateCallAgentParamsIvrNavigationMode, CreateCallAgentParamsOpenaiAccountConnection, @@ -143,24 +93,11 @@ CreateCallAgentParamsVectorDatabase, CreateCallAgentParamsVoice, CreateCallAgentParamsVoiceOne, - CreateCallAgentParamsVoiceOne_VoiceAzure, - CreateCallAgentParamsVoiceOne_VoiceElevenLabs, - CreateCallAgentParamsVoiceOne_VoicePlayHt, - CreateCallAgentParamsVoiceOne_VoiceRime, CreateCallAgentParamsWebhook, DtmfAction, - DtmfActionActionTrigger, - DtmfActionActionTrigger_ActionTriggerFunctionCall, - DtmfActionActionTrigger_ActionTriggerPhraseBased, DtmfActionParams, - DtmfActionParamsActionTrigger, - DtmfActionParamsActionTrigger_ActionTriggerFunctionCall, - DtmfActionParamsActionTrigger_ActionTriggerPhraseBased, DtmfActionUpdateParams, DtmfActionUpdateParamsActionTrigger, - DtmfActionUpdateParamsActionTriggerZero, - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, DtmfActionUpdateParamsConfig, ElevenLabsVoice, ElevenLabsVoiceParams, @@ -175,41 +112,29 @@ EmptyActionConfig, EndConversationAction, EndConversationActionActionTrigger, - EndConversationActionActionTrigger_ActionTriggerFunctionCall, - EndConversationActionActionTrigger_ActionTriggerPhraseBased, EndConversationActionParams, EndConversationActionParamsActionTrigger, - EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall, - EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased, EndConversationActionUpdateParams, EndConversationActionUpdateParamsActionTrigger, EndConversationActionUpdateParamsActionTriggerZero, - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, EndConversationActionUpdateParamsConfig, EventType, ExternalAction, - ExternalActionActionTrigger, - ExternalActionActionTrigger_ActionTriggerFunctionCall, - ExternalActionActionTrigger_ActionTriggerPhraseBased, ExternalActionConfig, ExternalActionParams, - ExternalActionParamsActionTrigger, - ExternalActionParamsActionTrigger_ActionTriggerFunctionCall, - ExternalActionParamsActionTrigger_ActionTriggerPhraseBased, ExternalActionUpdateParams, ExternalActionUpdateParamsActionTrigger, - ExternalActionUpdateParamsActionTriggerZero, - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, ExternalActionUpdateParamsConfig, FunctionCallActionTrigger, FunctionCallActionTriggerConfig, HttpMethod, HttpValidationError, + InternalLlmFallback, + InternalLlmFallbackProvider, InterruptSensitivity, Language, NormalizedAgent, + NormalizedAgentDeepgramKeywordsValue, NormalizedAgentEndpointingSensitivity, NormalizedAgentIvrNavigationMode, NormalizedAgentOpenaiAccountConnection, @@ -222,8 +147,6 @@ NormalizedCallStageOutcome, NormalizedCallTelephonyAccountConnection, NormalizedCallTelephonyMetadata, - NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio, - NormalizedCallTelephonyMetadata_TelephonyMetadataVonage, NormalizedCallTelephonyProvider, NormalizedPhoneNumber, NormalizedPhoneNumberTelephonyAccountConnection, @@ -237,8 +160,9 @@ PhoneNumber, PhoneNumberPage, PhoneNumberTelephonyProvider, - PhraseBasedActionTrigger, PhraseBasedActionTriggerConfig, + PhraseBasedActionTriggerInput, + PhraseBasedActionTriggerOutput, PhraseTrigger, PineconeVectorDatabase, PineconeVectorDatabaseParams, @@ -285,31 +209,19 @@ RimeVoiceUpdateParamsSpeedAlpha, SetHoldAction, SetHoldActionActionTrigger, - SetHoldActionActionTrigger_ActionTriggerFunctionCall, - SetHoldActionActionTrigger_ActionTriggerPhraseBased, SetHoldActionParams, SetHoldActionParamsActionTrigger, - SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall, - SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased, SetHoldActionUpdateParams, SetHoldActionUpdateParamsActionTrigger, SetHoldActionUpdateParamsActionTriggerZero, - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, SetHoldActionUpdateParamsConfig, TransferCallAction, TransferCallActionActionTrigger, - TransferCallActionActionTrigger_ActionTriggerFunctionCall, - TransferCallActionActionTrigger_ActionTriggerPhraseBased, TransferCallActionParams, TransferCallActionParamsActionTrigger, - TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall, - TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased, TransferCallActionUpdateParams, TransferCallActionUpdateParamsActionTrigger, TransferCallActionUpdateParamsActionTriggerZero, - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, TransferCallActionUpdateParamsConfig, TransferCallConfig, TwilioAccountConnection, @@ -323,27 +235,15 @@ ValidationError, ValidationErrorLocItem, VectorDatabasePage, + VocodeVoice, + VocodeVoiceParams, + VocodeVoiceUpdateParams, + VocodeVoiceUpdateParamsVoiceId, VoicePage, VoicePageItemsItem, - VoicePageItemsItem_VoiceAzure, - VoicePageItemsItem_VoiceElevenLabs, - VoicePageItemsItem_VoicePlayHt, - VoicePageItemsItem_VoiceRime, VoiceParamsRequest, - VoiceParamsRequest_VoiceAzure, - VoiceParamsRequest_VoiceElevenLabs, - VoiceParamsRequest_VoicePlayHt, - VoiceParamsRequest_VoiceRime, VoiceResponseModel, - VoiceResponseModel_VoiceAzure, - VoiceResponseModel_VoiceElevenLabs, - VoiceResponseModel_VoicePlayHt, - VoiceResponseModel_VoiceRime, VoiceUpdateParamsRequest, - VoiceUpdateParamsRequest_VoiceAzure, - VoiceUpdateParamsRequest_VoiceElevenLabs, - VoiceUpdateParamsRequest_VoicePlayHt, - VoiceUpdateParamsRequest_VoiceRime, VonageTelephonyMetadata, Webhook, WebhookPage, @@ -354,123 +254,52 @@ WebhookUpdateParamsUrl, ) from .errors import UnprocessableEntityError -from .resources import ( - AgentParamsActionsItem, - AgentParamsActionsItemOne, - AgentParamsActionsItemOne_ActionAddToConference, - AgentParamsActionsItemOne_ActionDtmf, - AgentParamsActionsItemOne_ActionEndConversation, - AgentParamsActionsItemOne_ActionExternal, - AgentParamsActionsItemOne_ActionSetHold, - AgentParamsActionsItemOne_ActionTransferCall, - AgentParamsEndpointingSensitivity, - AgentParamsIvrNavigationMode, - AgentParamsOpenaiAccountConnection, - AgentParamsPrompt, - AgentParamsVectorDatabase, - AgentParamsVoice, - AgentParamsVoiceOne, - AgentParamsVoiceOne_VoiceAzure, - AgentParamsVoiceOne_VoiceElevenLabs, - AgentParamsVoiceOne_VoicePlayHt, - AgentParamsVoiceOne_VoiceRime, - AgentParamsWebhook, - CreateCallRequestAgent, - CreateCallRequestOnNoHumanAnswer, +from . import account_connections, actions, agents, calls, numbers, prompts, usage, vector_databases, voices, webhooks +from .calls import CreateCallRequestAgent, CreateCallRequestOnNoHumanAnswer +from .client import AsyncVocode, Vocode +from .environment import VocodeEnvironment +from .numbers import ( + BuyPhoneNumberRequestInboundAgent, + BuyPhoneNumberRequestTelephonyProvider, + LinkPhoneNumberRequestInboundAgent, UpdateNumberRequestExampleContext, UpdateNumberRequestInboundAgent, UpdateNumberRequestLabel, UpdateNumberRequestOutboundOnly, - account_connections, - actions, - agents, - calls, - numbers, - prompts, - usage, - vector_databases, - voices, - webhooks, ) -from .environment import VocodeEnvironment +from .version import __version__ __all__ = [ "AccountConnectionPage", "AccountConnectionPageItemsItem", - "AccountConnectionPageItemsItem_AccountConnectionOpenai", - "AccountConnectionPageItemsItem_AccountConnectionTwilio", "AccountConnectionParamsRequest", - "AccountConnectionParamsRequest_AccountConnectionOpenai", - "AccountConnectionParamsRequest_AccountConnectionTwilio", "AccountConnectionResponseModel", - "AccountConnectionResponseModel_AccountConnectionOpenai", - "AccountConnectionResponseModel_AccountConnectionTwilio", "AccountConnectionUpdateParamsRequest", - "AccountConnectionUpdateParamsRequest_AccountConnectionOpenai", - "AccountConnectionUpdateParamsRequest_AccountConnectionTwilio", "ActionPage", "ActionPageItemsItem", - "ActionPageItemsItem_ActionAddToConference", - "ActionPageItemsItem_ActionDtmf", - "ActionPageItemsItem_ActionEndConversation", - "ActionPageItemsItem_ActionExternal", - "ActionPageItemsItem_ActionSetHold", - "ActionPageItemsItem_ActionTransferCall", "ActionParamsRequest", - "ActionParamsRequest_ActionAddToConference", - "ActionParamsRequest_ActionDtmf", - "ActionParamsRequest_ActionEndConversation", - "ActionParamsRequest_ActionExternal", - "ActionParamsRequest_ActionSetHold", - "ActionParamsRequest_ActionTransferCall", "ActionResponseModel", - "ActionResponseModel_ActionAddToConference", - "ActionResponseModel_ActionDtmf", - "ActionResponseModel_ActionEndConversation", - "ActionResponseModel_ActionExternal", - "ActionResponseModel_ActionSetHold", - "ActionResponseModel_ActionTransferCall", "ActionUpdateParamsRequest", - "ActionUpdateParamsRequest_ActionAddToConference", - "ActionUpdateParamsRequest_ActionDtmf", - "ActionUpdateParamsRequest_ActionEndConversation", - "ActionUpdateParamsRequest_ActionExternal", - "ActionUpdateParamsRequest_ActionSetHold", - "ActionUpdateParamsRequest_ActionTransferCall", "AddToConferenceAction", "AddToConferenceActionActionTrigger", - "AddToConferenceActionActionTrigger_ActionTriggerFunctionCall", - "AddToConferenceActionActionTrigger_ActionTriggerPhraseBased", "AddToConferenceActionParams", "AddToConferenceActionParamsActionTrigger", - "AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall", - "AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased", "AddToConferenceActionUpdateParams", "AddToConferenceActionUpdateParamsActionTrigger", "AddToConferenceActionUpdateParamsActionTriggerZero", - "AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "AddToConferenceActionUpdateParamsConfig", "AddToConferenceConfig", + "AddToSteeringPoolBody", "Agent", "AgentActionsItem", - "AgentActionsItem_ActionAddToConference", - "AgentActionsItem_ActionDtmf", - "AgentActionsItem_ActionEndConversation", - "AgentActionsItem_ActionExternal", - "AgentActionsItem_ActionSetHold", - "AgentActionsItem_ActionTransferCall", + "AgentDeepgramKeywordsValue", "AgentEndpointingSensitivity", "AgentIvrNavigationMode", "AgentPage", + "AgentParams", "AgentParamsActionsItem", "AgentParamsActionsItemOne", - "AgentParamsActionsItemOne_ActionAddToConference", - "AgentParamsActionsItemOne_ActionDtmf", - "AgentParamsActionsItemOne_ActionEndConversation", - "AgentParamsActionsItemOne_ActionExternal", - "AgentParamsActionsItemOne_ActionSetHold", - "AgentParamsActionsItemOne_ActionTransferCall", + "AgentParamsDeepgramKeywordsValue", "AgentParamsEndpointingSensitivity", "AgentParamsIvrNavigationMode", "AgentParamsOpenaiAccountConnection", @@ -478,30 +307,23 @@ "AgentParamsVectorDatabase", "AgentParamsVoice", "AgentParamsVoiceOne", - "AgentParamsVoiceOne_VoiceAzure", - "AgentParamsVoiceOne_VoiceElevenLabs", - "AgentParamsVoiceOne_VoicePlayHt", - "AgentParamsVoiceOne_VoiceRime", "AgentParamsWebhook", "AgentUpdateParams", "AgentUpdateParamsActions", "AgentUpdateParamsActionsItem", "AgentUpdateParamsActionsItemOne", - "AgentUpdateParamsActionsItemOne_ActionAddToConference", - "AgentUpdateParamsActionsItemOne_ActionDtmf", - "AgentUpdateParamsActionsItemOne_ActionEndConversation", - "AgentUpdateParamsActionsItemOne_ActionExternal", - "AgentUpdateParamsActionsItemOne_ActionSetHold", - "AgentUpdateParamsActionsItemOne_ActionTransferCall", "AgentUpdateParamsAskIfHumanPresentOnIdle", "AgentUpdateParamsContextEndpoint", "AgentUpdateParamsConversationSpeed", + "AgentUpdateParamsDeepgramKeywords", + "AgentUpdateParamsDeepgramKeywordsZeroValue", "AgentUpdateParamsEndpointingSensitivity", "AgentUpdateParamsInitialMessage", "AgentUpdateParamsInitialMessageDelay", "AgentUpdateParamsInterruptSensitivity", "AgentUpdateParamsIvrNavigationMode", "AgentUpdateParamsLanguage", + "AgentUpdateParamsLlmFallback", "AgentUpdateParamsName", "AgentUpdateParamsNoiseSuppression", "AgentUpdateParamsOpenaiAccountConnection", @@ -511,23 +333,16 @@ "AgentUpdateParamsVectorDatabase", "AgentUpdateParamsVoice", "AgentUpdateParamsVoiceOne", - "AgentUpdateParamsVoiceOne_VoiceAzure", - "AgentUpdateParamsVoiceOne_VoiceElevenLabs", - "AgentUpdateParamsVoiceOne_VoicePlayHt", - "AgentUpdateParamsVoiceOne_VoiceRime", "AgentUpdateParamsWebhook", "AgentVoice", - "AgentVoice_VoiceAzure", - "AgentVoice_VoiceElevenLabs", - "AgentVoice_VoicePlayHt", - "AgentVoice_VoiceRime", + "AsyncVocode", "AzureVoice", "AzureVoiceParams", "AzureVoiceUpdateParams", "AzureVoiceUpdateParamsPitch", "AzureVoiceUpdateParamsRate", "AzureVoiceUpdateParamsVoiceName", - "BuyPhoneNumberRequest", + "BuyPhoneNumberRequestInboundAgent", "BuyPhoneNumberRequestTelephonyProvider", "Call", "CallHumanDetectionResult", @@ -537,19 +352,12 @@ "CallStageOutcome", "CallStatus", "CallTelephonyMetadata", - "CallTelephonyMetadata_TelephonyMetadataTwilio", - "CallTelephonyMetadata_TelephonyMetadataVonage", "CallTelephonyProvider", "CollectField", "CreateCallAgentParams", "CreateCallAgentParamsActionsItem", "CreateCallAgentParamsActionsItemOne", - "CreateCallAgentParamsActionsItemOne_ActionAddToConference", - "CreateCallAgentParamsActionsItemOne_ActionDtmf", - "CreateCallAgentParamsActionsItemOne_ActionEndConversation", - "CreateCallAgentParamsActionsItemOne_ActionExternal", - "CreateCallAgentParamsActionsItemOne_ActionSetHold", - "CreateCallAgentParamsActionsItemOne_ActionTransferCall", + "CreateCallAgentParamsDeepgramKeywordsValue", "CreateCallAgentParamsEndpointingSensitivity", "CreateCallAgentParamsIvrNavigationMode", "CreateCallAgentParamsOpenaiAccountConnection", @@ -557,26 +365,13 @@ "CreateCallAgentParamsVectorDatabase", "CreateCallAgentParamsVoice", "CreateCallAgentParamsVoiceOne", - "CreateCallAgentParamsVoiceOne_VoiceAzure", - "CreateCallAgentParamsVoiceOne_VoiceElevenLabs", - "CreateCallAgentParamsVoiceOne_VoicePlayHt", - "CreateCallAgentParamsVoiceOne_VoiceRime", "CreateCallAgentParamsWebhook", "CreateCallRequestAgent", "CreateCallRequestOnNoHumanAnswer", "DtmfAction", - "DtmfActionActionTrigger", - "DtmfActionActionTrigger_ActionTriggerFunctionCall", - "DtmfActionActionTrigger_ActionTriggerPhraseBased", "DtmfActionParams", - "DtmfActionParamsActionTrigger", - "DtmfActionParamsActionTrigger_ActionTriggerFunctionCall", - "DtmfActionParamsActionTrigger_ActionTriggerPhraseBased", "DtmfActionUpdateParams", "DtmfActionUpdateParamsActionTrigger", - "DtmfActionUpdateParamsActionTriggerZero", - "DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "DtmfActionUpdateParamsConfig", "ElevenLabsVoice", "ElevenLabsVoiceParams", @@ -591,41 +386,30 @@ "EmptyActionConfig", "EndConversationAction", "EndConversationActionActionTrigger", - "EndConversationActionActionTrigger_ActionTriggerFunctionCall", - "EndConversationActionActionTrigger_ActionTriggerPhraseBased", "EndConversationActionParams", "EndConversationActionParamsActionTrigger", - "EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall", - "EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased", "EndConversationActionUpdateParams", "EndConversationActionUpdateParamsActionTrigger", "EndConversationActionUpdateParamsActionTriggerZero", - "EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "EndConversationActionUpdateParamsConfig", "EventType", "ExternalAction", - "ExternalActionActionTrigger", - "ExternalActionActionTrigger_ActionTriggerFunctionCall", - "ExternalActionActionTrigger_ActionTriggerPhraseBased", "ExternalActionConfig", "ExternalActionParams", - "ExternalActionParamsActionTrigger", - "ExternalActionParamsActionTrigger_ActionTriggerFunctionCall", - "ExternalActionParamsActionTrigger_ActionTriggerPhraseBased", "ExternalActionUpdateParams", "ExternalActionUpdateParamsActionTrigger", - "ExternalActionUpdateParamsActionTriggerZero", - "ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "ExternalActionUpdateParamsConfig", "FunctionCallActionTrigger", "FunctionCallActionTriggerConfig", "HttpMethod", "HttpValidationError", + "InternalLlmFallback", + "InternalLlmFallbackProvider", "InterruptSensitivity", "Language", + "LinkPhoneNumberRequestInboundAgent", "NormalizedAgent", + "NormalizedAgentDeepgramKeywordsValue", "NormalizedAgentEndpointingSensitivity", "NormalizedAgentIvrNavigationMode", "NormalizedAgentOpenaiAccountConnection", @@ -638,8 +422,6 @@ "NormalizedCallStageOutcome", "NormalizedCallTelephonyAccountConnection", "NormalizedCallTelephonyMetadata", - "NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio", - "NormalizedCallTelephonyMetadata_TelephonyMetadataVonage", "NormalizedCallTelephonyProvider", "NormalizedPhoneNumber", "NormalizedPhoneNumberTelephonyAccountConnection", @@ -653,8 +435,9 @@ "PhoneNumber", "PhoneNumberPage", "PhoneNumberTelephonyProvider", - "PhraseBasedActionTrigger", "PhraseBasedActionTriggerConfig", + "PhraseBasedActionTriggerInput", + "PhraseBasedActionTriggerOutput", "PhraseTrigger", "PineconeVectorDatabase", "PineconeVectorDatabaseParams", @@ -701,31 +484,19 @@ "RimeVoiceUpdateParamsSpeedAlpha", "SetHoldAction", "SetHoldActionActionTrigger", - "SetHoldActionActionTrigger_ActionTriggerFunctionCall", - "SetHoldActionActionTrigger_ActionTriggerPhraseBased", "SetHoldActionParams", "SetHoldActionParamsActionTrigger", - "SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall", - "SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased", "SetHoldActionUpdateParams", "SetHoldActionUpdateParamsActionTrigger", "SetHoldActionUpdateParamsActionTriggerZero", - "SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "SetHoldActionUpdateParamsConfig", "TransferCallAction", "TransferCallActionActionTrigger", - "TransferCallActionActionTrigger_ActionTriggerFunctionCall", - "TransferCallActionActionTrigger_ActionTriggerPhraseBased", "TransferCallActionParams", "TransferCallActionParamsActionTrigger", - "TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall", - "TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased", "TransferCallActionUpdateParams", "TransferCallActionUpdateParamsActionTrigger", "TransferCallActionUpdateParamsActionTriggerZero", - "TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "TransferCallActionUpdateParamsConfig", "TransferCallConfig", "TwilioAccountConnection", @@ -744,28 +515,17 @@ "ValidationError", "ValidationErrorLocItem", "VectorDatabasePage", + "Vocode", "VocodeEnvironment", + "VocodeVoice", + "VocodeVoiceParams", + "VocodeVoiceUpdateParams", + "VocodeVoiceUpdateParamsVoiceId", "VoicePage", "VoicePageItemsItem", - "VoicePageItemsItem_VoiceAzure", - "VoicePageItemsItem_VoiceElevenLabs", - "VoicePageItemsItem_VoicePlayHt", - "VoicePageItemsItem_VoiceRime", "VoiceParamsRequest", - "VoiceParamsRequest_VoiceAzure", - "VoiceParamsRequest_VoiceElevenLabs", - "VoiceParamsRequest_VoicePlayHt", - "VoiceParamsRequest_VoiceRime", "VoiceResponseModel", - "VoiceResponseModel_VoiceAzure", - "VoiceResponseModel_VoiceElevenLabs", - "VoiceResponseModel_VoicePlayHt", - "VoiceResponseModel_VoiceRime", "VoiceUpdateParamsRequest", - "VoiceUpdateParamsRequest_VoiceAzure", - "VoiceUpdateParamsRequest_VoiceElevenLabs", - "VoiceUpdateParamsRequest_VoicePlayHt", - "VoiceUpdateParamsRequest_VoiceRime", "VonageTelephonyMetadata", "Webhook", "WebhookPage", @@ -774,6 +534,7 @@ "WebhookUpdateParamsMethod", "WebhookUpdateParamsSubscriptions", "WebhookUpdateParamsUrl", + "__version__", "account_connections", "actions", "agents", diff --git a/src/vocode/resources/account_connections/__init__.py b/src/vocode/account_connections/__init__.py similarity index 100% rename from src/vocode/resources/account_connections/__init__.py rename to src/vocode/account_connections/__init__.py diff --git a/src/vocode/account_connections/client.py b/src/vocode/account_connections/client.py new file mode 100644 index 0000000..7ecb4a0 --- /dev/null +++ b/src/vocode/account_connections/client.py @@ -0,0 +1,865 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.account_connection_response_model import AccountConnectionResponseModel +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.account_connection_page import AccountConnectionPage +from ..types.account_connection_params_request import AccountConnectionParamsRequest +from ..types.account_connection_update_params_request import AccountConnectionUpdateParamsRequest +from ..types.add_to_steering_pool_body import AddToSteeringPoolBody +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AccountConnectionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_account_connection( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.get_account_connection( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_account_connections( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AccountConnectionPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.list_account_connections() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionPage, + parse_obj_as( + type_=AccountConnectionPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_account_connection( + self, *, request: AccountConnectionParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + request : AccountConnectionParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + from vocode import OpenAiAccountConnectionParams, OpenAiCredentials, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.create_account_connection( + request=OpenAiAccountConnectionParams( + credentials=OpenAiCredentials( + openai_api_key="openai_api_key", + ), + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_account_connection( + self, + *, + id: str, + request: AccountConnectionUpdateParamsRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + id : str + + request : AccountConnectionUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + from vocode import OpenAiAccountConnectionUpdateParams, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.update_account_connection( + id="id", + request=OpenAiAccountConnectionUpdateParams(), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def add_to_steering_pool( + self, + *, + id: str, + request: typing.Optional[AddToSteeringPoolBody] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[typing.Any]: + """ + Parameters + ---------- + id : str + + request : typing.Optional[AddToSteeringPoolBody] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.add_to_steering_pool( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections/add_to_steering_pool", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def remove_from_steering_pool( + self, *, id: str, phone_number: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[typing.Any]: + """ + Parameters + ---------- + id : str + + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.account_connections.remove_from_steering_pool( + id="id", + phone_number="phone_number", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/account_connections/remove_from_steering_pool", + method="POST", + params={ + "id": id, + }, + json={ + "phone_number": phone_number, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncAccountConnectionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_account_connection( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.get_account_connection( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_account_connections( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AccountConnectionPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.list_account_connections() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionPage, + parse_obj_as( + type_=AccountConnectionPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_account_connection( + self, *, request: AccountConnectionParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + request : AccountConnectionParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode, OpenAiAccountConnectionParams, OpenAiCredentials + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.create_account_connection( + request=OpenAiAccountConnectionParams( + credentials=OpenAiCredentials( + openai_api_key="openai_api_key", + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_account_connection( + self, + *, + id: str, + request: AccountConnectionUpdateParamsRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AccountConnectionResponseModel: + """ + Parameters + ---------- + id : str + + request : AccountConnectionUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AccountConnectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode, OpenAiAccountConnectionUpdateParams + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.update_account_connection( + id="id", + request=OpenAiAccountConnectionUpdateParams(), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AccountConnectionResponseModel, + parse_obj_as( + type_=AccountConnectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def add_to_steering_pool( + self, + *, + id: str, + request: typing.Optional[AddToSteeringPoolBody] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[typing.Any]: + """ + Parameters + ---------- + id : str + + request : typing.Optional[AddToSteeringPoolBody] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.add_to_steering_pool( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections/add_to_steering_pool", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def remove_from_steering_pool( + self, *, id: str, phone_number: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[typing.Any]: + """ + Parameters + ---------- + id : str + + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.account_connections.remove_from_steering_pool( + id="id", + phone_number="phone_number", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/account_connections/remove_from_steering_pool", + method="POST", + params={ + "id": id, + }, + json={ + "phone_number": phone_number, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/actions/__init__.py b/src/vocode/actions/__init__.py similarity index 100% rename from src/vocode/resources/actions/__init__.py rename to src/vocode/actions/__init__.py diff --git a/src/vocode/actions/client.py b/src/vocode/actions/client.py new file mode 100644 index 0000000..02d9758 --- /dev/null +++ b/src/vocode/actions/client.py @@ -0,0 +1,576 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.action_response_model import ActionResponseModel +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.action_page import ActionPage +from ..types.action_params_request import ActionParamsRequest +from ..types.action_update_params_request import ActionUpdateParamsRequest +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ActionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_action(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> ActionResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.actions.get_action( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/actions", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_actions( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ActionPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.actions.list_actions() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/actions/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionPage, + parse_obj_as( + type_=ActionPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_action( + self, *, request: ActionParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> ActionResponseModel: + """ + Parameters + ---------- + request : ActionParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + from vocode import AddToConferenceActionParams, AddToConferenceConfig, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.actions.create_action( + request=AddToConferenceActionParams( + config=AddToConferenceConfig( + phone_number="phone_number", + ), + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/actions/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_action( + self, *, id: str, request: ActionUpdateParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> ActionResponseModel: + """ + Parameters + ---------- + id : str + + request : ActionUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + from vocode import AddToConferenceActionUpdateParams, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.actions.update_action( + id="id", + request=AddToConferenceActionUpdateParams(), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/actions/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncActionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_action( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> ActionResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.actions.get_action( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/actions", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_actions( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ActionPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.actions.list_actions() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/actions/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionPage, + parse_obj_as( + type_=ActionPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_action( + self, *, request: ActionParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> ActionResponseModel: + """ + Parameters + ---------- + request : ActionParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import ( + AddToConferenceActionParams, + AddToConferenceConfig, + AsyncVocode, + ) + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.actions.create_action( + request=AddToConferenceActionParams( + config=AddToConferenceConfig( + phone_number="phone_number", + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/actions/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_action( + self, *, id: str, request: ActionUpdateParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> ActionResponseModel: + """ + Parameters + ---------- + id : str + + request : ActionUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AddToConferenceActionUpdateParams, AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.actions.update_action( + id="id", + request=AddToConferenceActionUpdateParams(), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/actions/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + ActionResponseModel, + parse_obj_as( + type_=ActionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/prompts/__init__.py b/src/vocode/agents/__init__.py similarity index 100% rename from src/vocode/resources/prompts/__init__.py rename to src/vocode/agents/__init__.py diff --git a/src/vocode/agents/client.py b/src/vocode/agents/client.py new file mode 100644 index 0000000..ca444c4 --- /dev/null +++ b/src/vocode/agents/client.py @@ -0,0 +1,943 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.agent import Agent +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.agent_page import AgentPage +from ..types.agent_params_prompt import AgentParamsPrompt +from ..types.agent_params_voice import AgentParamsVoice +from ..types.language import Language +from ..types.agent_params_actions_item import AgentParamsActionsItem +from ..types.agent_params_webhook import AgentParamsWebhook +from ..types.agent_params_vector_database import AgentParamsVectorDatabase +from ..types.interrupt_sensitivity import InterruptSensitivity +from ..types.agent_params_endpointing_sensitivity import AgentParamsEndpointingSensitivity +from ..types.agent_params_ivr_navigation_mode import AgentParamsIvrNavigationMode +from ..types.agent_params_openai_account_connection import AgentParamsOpenaiAccountConnection +from ..types.internal_llm_fallback import InternalLlmFallback +from ..types.agent_params_deepgram_keywords_value import AgentParamsDeepgramKeywordsValue +from ..types.agent_update_params_name import AgentUpdateParamsName +from ..types.agent_update_params_prompt import AgentUpdateParamsPrompt +from ..types.agent_update_params_language import AgentUpdateParamsLanguage +from ..types.agent_update_params_actions import AgentUpdateParamsActions +from ..types.agent_update_params_voice import AgentUpdateParamsVoice +from ..types.agent_update_params_initial_message import AgentUpdateParamsInitialMessage +from ..types.agent_update_params_webhook import AgentUpdateParamsWebhook +from ..types.agent_update_params_vector_database import AgentUpdateParamsVectorDatabase +from ..types.agent_update_params_interrupt_sensitivity import AgentUpdateParamsInterruptSensitivity +from ..types.agent_update_params_context_endpoint import AgentUpdateParamsContextEndpoint +from ..types.agent_update_params_noise_suppression import AgentUpdateParamsNoiseSuppression +from ..types.agent_update_params_endpointing_sensitivity import AgentUpdateParamsEndpointingSensitivity +from ..types.agent_update_params_ivr_navigation_mode import AgentUpdateParamsIvrNavigationMode +from ..types.agent_update_params_conversation_speed import AgentUpdateParamsConversationSpeed +from ..types.agent_update_params_initial_message_delay import AgentUpdateParamsInitialMessageDelay +from ..types.agent_update_params_openai_model_name_override import AgentUpdateParamsOpenaiModelNameOverride +from ..types.agent_update_params_ask_if_human_present_on_idle import AgentUpdateParamsAskIfHumanPresentOnIdle +from ..types.agent_update_params_openai_account_connection import AgentUpdateParamsOpenaiAccountConnection +from ..types.agent_update_params_run_do_not_call_detection import AgentUpdateParamsRunDoNotCallDetection +from ..types.agent_update_params_llm_fallback import AgentUpdateParamsLlmFallback +from ..types.agent_update_params_deepgram_keywords import AgentUpdateParamsDeepgramKeywords +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AgentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_agent(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Agent: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.agents.get_agent( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/agents", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_agents( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.agents.list_agents() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/agents/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AgentPage, + parse_obj_as( + type_=AgentPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_agent( + self, + *, + prompt: AgentParamsPrompt, + voice: AgentParamsVoice, + name: typing.Optional[str] = OMIT, + language: typing.Optional[Language] = OMIT, + actions: typing.Optional[typing.Sequence[AgentParamsActionsItem]] = OMIT, + initial_message: typing.Optional[str] = OMIT, + webhook: typing.Optional[AgentParamsWebhook] = OMIT, + vector_database: typing.Optional[AgentParamsVectorDatabase] = OMIT, + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = OMIT, + context_endpoint: typing.Optional[str] = OMIT, + noise_suppression: typing.Optional[bool] = OMIT, + endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT, + ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT, + conversation_speed: typing.Optional[float] = OMIT, + initial_message_delay: typing.Optional[float] = OMIT, + openai_model_name_override: typing.Optional[str] = OMIT, + ask_if_human_present_on_idle: typing.Optional[bool] = OMIT, + openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection] = OMIT, + run_do_not_call_detection: typing.Optional[bool] = OMIT, + llm_fallback: typing.Optional[InternalLlmFallback] = OMIT, + deepgram_keywords: typing.Optional[typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]]] = OMIT, + llm_temperature: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Agent: + """ + Parameters + ---------- + prompt : AgentParamsPrompt + + voice : AgentParamsVoice + + name : typing.Optional[str] + + language : typing.Optional[Language] + + actions : typing.Optional[typing.Sequence[AgentParamsActionsItem]] + + initial_message : typing.Optional[str] + + webhook : typing.Optional[AgentParamsWebhook] + + vector_database : typing.Optional[AgentParamsVectorDatabase] + + interrupt_sensitivity : typing.Optional[InterruptSensitivity] + + context_endpoint : typing.Optional[str] + + noise_suppression : typing.Optional[bool] + + endpointing_sensitivity : typing.Optional[AgentParamsEndpointingSensitivity] + + ivr_navigation_mode : typing.Optional[AgentParamsIvrNavigationMode] + + conversation_speed : typing.Optional[float] + + initial_message_delay : typing.Optional[float] + + openai_model_name_override : typing.Optional[str] + + ask_if_human_present_on_idle : typing.Optional[bool] + + openai_account_connection : typing.Optional[AgentParamsOpenaiAccountConnection] + + run_do_not_call_detection : typing.Optional[bool] + + llm_fallback : typing.Optional[InternalLlmFallback] + + deepgram_keywords : typing.Optional[typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]]] + + llm_temperature : typing.Optional[float] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.agents.create_agent( + prompt="prompt", + voice="voice", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/agents/create", + method="POST", + json={ + "name": name, + "prompt": prompt, + "language": language, + "actions": actions, + "voice": voice, + "initial_message": initial_message, + "webhook": webhook, + "vector_database": vector_database, + "interrupt_sensitivity": interrupt_sensitivity, + "context_endpoint": context_endpoint, + "noise_suppression": noise_suppression, + "endpointing_sensitivity": endpointing_sensitivity, + "ivr_navigation_mode": ivr_navigation_mode, + "conversation_speed": conversation_speed, + "initial_message_delay": initial_message_delay, + "openai_model_name_override": openai_model_name_override, + "ask_if_human_present_on_idle": ask_if_human_present_on_idle, + "openai_account_connection": openai_account_connection, + "run_do_not_call_detection": run_do_not_call_detection, + "llm_fallback": llm_fallback, + "deepgram_keywords": deepgram_keywords, + "llm_temperature": llm_temperature, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_agent( + self, + *, + id: str, + name: typing.Optional[AgentUpdateParamsName] = OMIT, + prompt: typing.Optional[AgentUpdateParamsPrompt] = OMIT, + language: typing.Optional[AgentUpdateParamsLanguage] = OMIT, + actions: typing.Optional[AgentUpdateParamsActions] = OMIT, + voice: typing.Optional[AgentUpdateParamsVoice] = OMIT, + initial_message: typing.Optional[AgentUpdateParamsInitialMessage] = OMIT, + webhook: typing.Optional[AgentUpdateParamsWebhook] = OMIT, + vector_database: typing.Optional[AgentUpdateParamsVectorDatabase] = OMIT, + interrupt_sensitivity: typing.Optional[AgentUpdateParamsInterruptSensitivity] = OMIT, + context_endpoint: typing.Optional[AgentUpdateParamsContextEndpoint] = OMIT, + noise_suppression: typing.Optional[AgentUpdateParamsNoiseSuppression] = OMIT, + endpointing_sensitivity: typing.Optional[AgentUpdateParamsEndpointingSensitivity] = OMIT, + ivr_navigation_mode: typing.Optional[AgentUpdateParamsIvrNavigationMode] = OMIT, + conversation_speed: typing.Optional[AgentUpdateParamsConversationSpeed] = OMIT, + initial_message_delay: typing.Optional[AgentUpdateParamsInitialMessageDelay] = OMIT, + openai_model_name_override: typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] = OMIT, + ask_if_human_present_on_idle: typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] = OMIT, + openai_account_connection: typing.Optional[AgentUpdateParamsOpenaiAccountConnection] = OMIT, + run_do_not_call_detection: typing.Optional[AgentUpdateParamsRunDoNotCallDetection] = OMIT, + llm_fallback: typing.Optional[AgentUpdateParamsLlmFallback] = OMIT, + deepgram_keywords: typing.Optional[AgentUpdateParamsDeepgramKeywords] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Agent: + """ + Parameters + ---------- + id : str + + name : typing.Optional[AgentUpdateParamsName] + + prompt : typing.Optional[AgentUpdateParamsPrompt] + + language : typing.Optional[AgentUpdateParamsLanguage] + + actions : typing.Optional[AgentUpdateParamsActions] + + voice : typing.Optional[AgentUpdateParamsVoice] + + initial_message : typing.Optional[AgentUpdateParamsInitialMessage] + + webhook : typing.Optional[AgentUpdateParamsWebhook] + + vector_database : typing.Optional[AgentUpdateParamsVectorDatabase] + + interrupt_sensitivity : typing.Optional[AgentUpdateParamsInterruptSensitivity] + + context_endpoint : typing.Optional[AgentUpdateParamsContextEndpoint] + + noise_suppression : typing.Optional[AgentUpdateParamsNoiseSuppression] + + endpointing_sensitivity : typing.Optional[AgentUpdateParamsEndpointingSensitivity] + + ivr_navigation_mode : typing.Optional[AgentUpdateParamsIvrNavigationMode] + + conversation_speed : typing.Optional[AgentUpdateParamsConversationSpeed] + + initial_message_delay : typing.Optional[AgentUpdateParamsInitialMessageDelay] + + openai_model_name_override : typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] + + ask_if_human_present_on_idle : typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] + + openai_account_connection : typing.Optional[AgentUpdateParamsOpenaiAccountConnection] + + run_do_not_call_detection : typing.Optional[AgentUpdateParamsRunDoNotCallDetection] + + llm_fallback : typing.Optional[AgentUpdateParamsLlmFallback] + + deepgram_keywords : typing.Optional[AgentUpdateParamsDeepgramKeywords] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.agents.update_agent( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/agents/update", + method="POST", + params={ + "id": id, + }, + json={ + "name": name, + "prompt": prompt, + "language": language, + "actions": actions, + "voice": voice, + "initial_message": initial_message, + "webhook": webhook, + "vector_database": vector_database, + "interrupt_sensitivity": interrupt_sensitivity, + "context_endpoint": context_endpoint, + "noise_suppression": noise_suppression, + "endpointing_sensitivity": endpointing_sensitivity, + "ivr_navigation_mode": ivr_navigation_mode, + "conversation_speed": conversation_speed, + "initial_message_delay": initial_message_delay, + "openai_model_name_override": openai_model_name_override, + "ask_if_human_present_on_idle": ask_if_human_present_on_idle, + "openai_account_connection": openai_account_connection, + "run_do_not_call_detection": run_do_not_call_detection, + "llm_fallback": llm_fallback, + "deepgram_keywords": deepgram_keywords, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncAgentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_agent(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Agent: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.agents.get_agent( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/agents", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_agents( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.agents.list_agents() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/agents/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + AgentPage, + parse_obj_as( + type_=AgentPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_agent( + self, + *, + prompt: AgentParamsPrompt, + voice: AgentParamsVoice, + name: typing.Optional[str] = OMIT, + language: typing.Optional[Language] = OMIT, + actions: typing.Optional[typing.Sequence[AgentParamsActionsItem]] = OMIT, + initial_message: typing.Optional[str] = OMIT, + webhook: typing.Optional[AgentParamsWebhook] = OMIT, + vector_database: typing.Optional[AgentParamsVectorDatabase] = OMIT, + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = OMIT, + context_endpoint: typing.Optional[str] = OMIT, + noise_suppression: typing.Optional[bool] = OMIT, + endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT, + ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT, + conversation_speed: typing.Optional[float] = OMIT, + initial_message_delay: typing.Optional[float] = OMIT, + openai_model_name_override: typing.Optional[str] = OMIT, + ask_if_human_present_on_idle: typing.Optional[bool] = OMIT, + openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection] = OMIT, + run_do_not_call_detection: typing.Optional[bool] = OMIT, + llm_fallback: typing.Optional[InternalLlmFallback] = OMIT, + deepgram_keywords: typing.Optional[typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]]] = OMIT, + llm_temperature: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Agent: + """ + Parameters + ---------- + prompt : AgentParamsPrompt + + voice : AgentParamsVoice + + name : typing.Optional[str] + + language : typing.Optional[Language] + + actions : typing.Optional[typing.Sequence[AgentParamsActionsItem]] + + initial_message : typing.Optional[str] + + webhook : typing.Optional[AgentParamsWebhook] + + vector_database : typing.Optional[AgentParamsVectorDatabase] + + interrupt_sensitivity : typing.Optional[InterruptSensitivity] + + context_endpoint : typing.Optional[str] + + noise_suppression : typing.Optional[bool] + + endpointing_sensitivity : typing.Optional[AgentParamsEndpointingSensitivity] + + ivr_navigation_mode : typing.Optional[AgentParamsIvrNavigationMode] + + conversation_speed : typing.Optional[float] + + initial_message_delay : typing.Optional[float] + + openai_model_name_override : typing.Optional[str] + + ask_if_human_present_on_idle : typing.Optional[bool] + + openai_account_connection : typing.Optional[AgentParamsOpenaiAccountConnection] + + run_do_not_call_detection : typing.Optional[bool] + + llm_fallback : typing.Optional[InternalLlmFallback] + + deepgram_keywords : typing.Optional[typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]]] + + llm_temperature : typing.Optional[float] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.agents.create_agent( + prompt="prompt", + voice="voice", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/agents/create", + method="POST", + json={ + "name": name, + "prompt": prompt, + "language": language, + "actions": actions, + "voice": voice, + "initial_message": initial_message, + "webhook": webhook, + "vector_database": vector_database, + "interrupt_sensitivity": interrupt_sensitivity, + "context_endpoint": context_endpoint, + "noise_suppression": noise_suppression, + "endpointing_sensitivity": endpointing_sensitivity, + "ivr_navigation_mode": ivr_navigation_mode, + "conversation_speed": conversation_speed, + "initial_message_delay": initial_message_delay, + "openai_model_name_override": openai_model_name_override, + "ask_if_human_present_on_idle": ask_if_human_present_on_idle, + "openai_account_connection": openai_account_connection, + "run_do_not_call_detection": run_do_not_call_detection, + "llm_fallback": llm_fallback, + "deepgram_keywords": deepgram_keywords, + "llm_temperature": llm_temperature, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_agent( + self, + *, + id: str, + name: typing.Optional[AgentUpdateParamsName] = OMIT, + prompt: typing.Optional[AgentUpdateParamsPrompt] = OMIT, + language: typing.Optional[AgentUpdateParamsLanguage] = OMIT, + actions: typing.Optional[AgentUpdateParamsActions] = OMIT, + voice: typing.Optional[AgentUpdateParamsVoice] = OMIT, + initial_message: typing.Optional[AgentUpdateParamsInitialMessage] = OMIT, + webhook: typing.Optional[AgentUpdateParamsWebhook] = OMIT, + vector_database: typing.Optional[AgentUpdateParamsVectorDatabase] = OMIT, + interrupt_sensitivity: typing.Optional[AgentUpdateParamsInterruptSensitivity] = OMIT, + context_endpoint: typing.Optional[AgentUpdateParamsContextEndpoint] = OMIT, + noise_suppression: typing.Optional[AgentUpdateParamsNoiseSuppression] = OMIT, + endpointing_sensitivity: typing.Optional[AgentUpdateParamsEndpointingSensitivity] = OMIT, + ivr_navigation_mode: typing.Optional[AgentUpdateParamsIvrNavigationMode] = OMIT, + conversation_speed: typing.Optional[AgentUpdateParamsConversationSpeed] = OMIT, + initial_message_delay: typing.Optional[AgentUpdateParamsInitialMessageDelay] = OMIT, + openai_model_name_override: typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] = OMIT, + ask_if_human_present_on_idle: typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] = OMIT, + openai_account_connection: typing.Optional[AgentUpdateParamsOpenaiAccountConnection] = OMIT, + run_do_not_call_detection: typing.Optional[AgentUpdateParamsRunDoNotCallDetection] = OMIT, + llm_fallback: typing.Optional[AgentUpdateParamsLlmFallback] = OMIT, + deepgram_keywords: typing.Optional[AgentUpdateParamsDeepgramKeywords] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Agent: + """ + Parameters + ---------- + id : str + + name : typing.Optional[AgentUpdateParamsName] + + prompt : typing.Optional[AgentUpdateParamsPrompt] + + language : typing.Optional[AgentUpdateParamsLanguage] + + actions : typing.Optional[AgentUpdateParamsActions] + + voice : typing.Optional[AgentUpdateParamsVoice] + + initial_message : typing.Optional[AgentUpdateParamsInitialMessage] + + webhook : typing.Optional[AgentUpdateParamsWebhook] + + vector_database : typing.Optional[AgentUpdateParamsVectorDatabase] + + interrupt_sensitivity : typing.Optional[AgentUpdateParamsInterruptSensitivity] + + context_endpoint : typing.Optional[AgentUpdateParamsContextEndpoint] + + noise_suppression : typing.Optional[AgentUpdateParamsNoiseSuppression] + + endpointing_sensitivity : typing.Optional[AgentUpdateParamsEndpointingSensitivity] + + ivr_navigation_mode : typing.Optional[AgentUpdateParamsIvrNavigationMode] + + conversation_speed : typing.Optional[AgentUpdateParamsConversationSpeed] + + initial_message_delay : typing.Optional[AgentUpdateParamsInitialMessageDelay] + + openai_model_name_override : typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] + + ask_if_human_present_on_idle : typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] + + openai_account_connection : typing.Optional[AgentUpdateParamsOpenaiAccountConnection] + + run_do_not_call_detection : typing.Optional[AgentUpdateParamsRunDoNotCallDetection] + + llm_fallback : typing.Optional[AgentUpdateParamsLlmFallback] + + deepgram_keywords : typing.Optional[AgentUpdateParamsDeepgramKeywords] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Agent + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.agents.update_agent( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/agents/update", + method="POST", + params={ + "id": id, + }, + json={ + "name": name, + "prompt": prompt, + "language": language, + "actions": actions, + "voice": voice, + "initial_message": initial_message, + "webhook": webhook, + "vector_database": vector_database, + "interrupt_sensitivity": interrupt_sensitivity, + "context_endpoint": context_endpoint, + "noise_suppression": noise_suppression, + "endpointing_sensitivity": endpointing_sensitivity, + "ivr_navigation_mode": ivr_navigation_mode, + "conversation_speed": conversation_speed, + "initial_message_delay": initial_message_delay, + "openai_model_name_override": openai_model_name_override, + "ask_if_human_present_on_idle": ask_if_human_present_on_idle, + "openai_account_connection": openai_account_connection, + "run_do_not_call_detection": run_do_not_call_detection, + "llm_fallback": llm_fallback, + "deepgram_keywords": deepgram_keywords, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Agent, + parse_obj_as( + type_=Agent, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/calls/__init__.py b/src/vocode/calls/__init__.py similarity index 100% rename from src/vocode/resources/calls/__init__.py rename to src/vocode/calls/__init__.py diff --git a/src/vocode/calls/client.py b/src/vocode/calls/client.py new file mode 100644 index 0000000..cf0e909 --- /dev/null +++ b/src/vocode/calls/client.py @@ -0,0 +1,738 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.call_page import CallPage +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.call import Call +from .types.create_call_request_agent import CreateCallRequestAgent +from .types.create_call_request_on_no_human_answer import CreateCallRequestOnNoHumanAnswer +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class CallsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_calls( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CallPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CallPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.calls.list_calls() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/calls/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + CallPage, + parse_obj_as( + type_=CallPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_call(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Call: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.calls.get_call( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/calls", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def end_call(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Call: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.calls.end_call( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/calls/end", + method="POST", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_call( + self, + *, + from_number: str, + to_number: str, + agent: CreateCallRequestAgent, + on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer] = OMIT, + run_do_not_call_detection: typing.Optional[bool] = OMIT, + hipaa_compliant: typing.Optional[bool] = OMIT, + context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + telephony_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Call: + """ + Parameters + ---------- + from_number : str + + to_number : str + + agent : CreateCallRequestAgent + + on_no_human_answer : typing.Optional[CreateCallRequestOnNoHumanAnswer] + + run_do_not_call_detection : typing.Optional[bool] + + hipaa_compliant : typing.Optional[bool] + + context : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + telephony_params : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.calls.create_call( + from_number="from_number", + to_number="to_number", + agent="agent", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/calls/create", + method="POST", + json={ + "from_number": from_number, + "to_number": to_number, + "agent": agent, + "on_no_human_answer": on_no_human_answer, + "run_do_not_call_detection": run_do_not_call_detection, + "hipaa_compliant": hipaa_compliant, + "context": context, + "telephony_params": telephony_params, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_recording( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[bytes] + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.calls.get_recording( + id="string", + ) + """ + with self._client_wrapper.httpx_client.stream( + "v1/calls/recording", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) as _response: + try: + if 200 <= _response.status_code < 300: + for _chunk in _response.iter_bytes(): + yield _chunk + return + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncCallsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_calls( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CallPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CallPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.calls.list_calls() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/calls/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + CallPage, + parse_obj_as( + type_=CallPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_call(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Call: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.calls.get_call( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/calls", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def end_call(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Call: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.calls.end_call( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/calls/end", + method="POST", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_call( + self, + *, + from_number: str, + to_number: str, + agent: CreateCallRequestAgent, + on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer] = OMIT, + run_do_not_call_detection: typing.Optional[bool] = OMIT, + hipaa_compliant: typing.Optional[bool] = OMIT, + context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + telephony_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Call: + """ + Parameters + ---------- + from_number : str + + to_number : str + + agent : CreateCallRequestAgent + + on_no_human_answer : typing.Optional[CreateCallRequestOnNoHumanAnswer] + + run_do_not_call_detection : typing.Optional[bool] + + hipaa_compliant : typing.Optional[bool] + + context : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + telephony_params : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Call + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.calls.create_call( + from_number="from_number", + to_number="to_number", + agent="agent", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/calls/create", + method="POST", + json={ + "from_number": from_number, + "to_number": to_number, + "agent": agent, + "on_no_human_answer": on_no_human_answer, + "run_do_not_call_detection": run_do_not_call_detection, + "hipaa_compliant": hipaa_compliant, + "context": context, + "telephony_params": telephony_params, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Call, + parse_obj_as( + type_=Call, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_recording( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[bytes] + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.calls.get_recording( + id="string", + ) + + + asyncio.run(main()) + """ + async with self._client_wrapper.httpx_client.stream( + "v1/calls/recording", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) as _response: + try: + if 200 <= _response.status_code < 300: + async for _chunk in _response.aiter_bytes(): + yield _chunk + return + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/calls/types/__init__.py b/src/vocode/calls/types/__init__.py similarity index 100% rename from src/vocode/resources/calls/types/__init__.py rename to src/vocode/calls/types/__init__.py diff --git a/src/vocode/resources/calls/types/create_call_request_agent.py b/src/vocode/calls/types/create_call_request_agent.py similarity index 67% rename from src/vocode/resources/calls/types/create_call_request_agent.py rename to src/vocode/calls/types/create_call_request_agent.py index ba41feb..5b7605c 100644 --- a/src/vocode/resources/calls/types/create_call_request_agent.py +++ b/src/vocode/calls/types/create_call_request_agent.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.create_call_agent_params import CreateCallAgentParams +from ...types.create_call_agent_params import CreateCallAgentParams CreateCallRequestAgent = typing.Union[str, CreateCallAgentParams] diff --git a/src/vocode/calls/types/create_call_request_on_no_human_answer.py b/src/vocode/calls/types/create_call_request_on_no_human_answer.py new file mode 100644 index 0000000..16a4311 --- /dev/null +++ b/src/vocode/calls/types/create_call_request_on_no_human_answer.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateCallRequestOnNoHumanAnswer = typing.Union[typing.Literal["continue", "hangup"], typing.Any] diff --git a/src/vocode/client.py b/src/vocode/client.py index 3e89c3d..d2e5ce4 100644 --- a/src/vocode/client.py +++ b/src/vocode/client.py @@ -1,37 +1,93 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import httpx - -from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .environment import VocodeEnvironment -from .resources.account_connections.client import AccountConnectionsClient, AsyncAccountConnectionsClient -from .resources.actions.client import ActionsClient, AsyncActionsClient -from .resources.agents.client import AgentsClient, AsyncAgentsClient -from .resources.calls.client import AsyncCallsClient, CallsClient -from .resources.numbers.client import AsyncNumbersClient, NumbersClient -from .resources.prompts.client import AsyncPromptsClient, PromptsClient -from .resources.usage.client import AsyncUsageClient, UsageClient -from .resources.vector_databases.client import AsyncVectorDatabasesClient, VectorDatabasesClient -from .resources.voices.client import AsyncVoicesClient, VoicesClient -from .resources.webhooks.client import AsyncWebhooksClient, WebhooksClient +import httpx +from .core.client_wrapper import SyncClientWrapper +from .numbers.client import NumbersClient +from .calls.client import CallsClient +from .usage.client import UsageClient +from .actions.client import ActionsClient +from .agents.client import AgentsClient +from .voices.client import VoicesClient +from .webhooks.client import WebhooksClient +from .prompts.client import PromptsClient +from .vector_databases.client import VectorDatabasesClient +from .account_connections.client import AccountConnectionsClient +from .core.request_options import RequestOptions +from .core.pydantic_utilities import parse_obj_as +from json.decoder import JSONDecodeError +from .core.api_error import ApiError +from .core.client_wrapper import AsyncClientWrapper +from .numbers.client import AsyncNumbersClient +from .calls.client import AsyncCallsClient +from .usage.client import AsyncUsageClient +from .actions.client import AsyncActionsClient +from .agents.client import AsyncAgentsClient +from .voices.client import AsyncVoicesClient +from .webhooks.client import AsyncWebhooksClient +from .prompts.client import AsyncPromptsClient +from .vector_databases.client import AsyncVectorDatabasesClient +from .account_connections.client import AsyncAccountConnectionsClient class Vocode: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. + + Parameters + ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. + + environment : VocodeEnvironment + The environment to use for requests from the client. from .environment import VocodeEnvironment + + + + Defaults to VocodeEnvironment.PRODUCTION + + + + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.Client] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + """ + def __init__( self, *, base_url: typing.Optional[str] = None, environment: VocodeEnvironment = VocodeEnvironment.PRODUCTION, - token: typing.Union[str, typing.Callable[[], str]], - timeout: typing.Optional[float] = 60, - httpx_client: typing.Optional[httpx.Client] = None + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.Client] = None, ): + _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), token=token, - httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client, + httpx_client=httpx_client + if httpx_client is not None + else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) + if follow_redirects is not None + else httpx.Client(timeout=_defaulted_timeout), + timeout=_defaulted_timeout, ) self.numbers = NumbersClient(client_wrapper=self._client_wrapper) self.calls = CallsClient(client_wrapper=self._client_wrapper) @@ -44,21 +100,108 @@ def __init__( self.vector_databases = VectorDatabasesClient(client_wrapper=self._client_wrapper) self.account_connections = AccountConnectionsClient(client_wrapper=self._client_wrapper) + def metrics_metrics_get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[typing.Any]: + """ + Endpoint that serves Prometheus metrics. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.metrics_metrics_get() + """ + _response = self._client_wrapper.httpx_client.request( + "metrics", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncVocode: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. + + Parameters + ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. + + environment : VocodeEnvironment + The environment to use for requests from the client. from .environment import VocodeEnvironment + + + + Defaults to VocodeEnvironment.PRODUCTION + + + + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.AsyncClient] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + """ + def __init__( self, *, base_url: typing.Optional[str] = None, environment: VocodeEnvironment = VocodeEnvironment.PRODUCTION, - token: typing.Union[str, typing.Callable[[], str]], - timeout: typing.Optional[float] = 60, - httpx_client: typing.Optional[httpx.AsyncClient] = None + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.AsyncClient] = None, ): + _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), token=token, - httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client, + httpx_client=httpx_client + if httpx_client is not None + else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects) + if follow_redirects is not None + else httpx.AsyncClient(timeout=_defaulted_timeout), + timeout=_defaulted_timeout, ) self.numbers = AsyncNumbersClient(client_wrapper=self._client_wrapper) self.calls = AsyncCallsClient(client_wrapper=self._client_wrapper) @@ -71,6 +214,58 @@ def __init__( self.vector_databases = AsyncVectorDatabasesClient(client_wrapper=self._client_wrapper) self.account_connections = AsyncAccountConnectionsClient(client_wrapper=self._client_wrapper) + async def metrics_metrics_get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[typing.Any]: + """ + Endpoint that serves Prometheus metrics. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[typing.Any] + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.metrics_metrics_get() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "metrics", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def _get_base_url(*, base_url: typing.Optional[str] = None, environment: VocodeEnvironment) -> str: if base_url is not None: diff --git a/src/vocode/core/__init__.py b/src/vocode/core/__init__.py index 2414955..4213c34 100644 --- a/src/vocode/core/__init__.py +++ b/src/vocode/core/__init__.py @@ -3,15 +3,44 @@ from .api_error import ApiError from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper from .datetime_utils import serialize_datetime +from .file import File, convert_file_dict_to_httpx_tuples +from .http_client import AsyncHttpClient, HttpClient from .jsonable_encoder import jsonable_encoder +from .pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + UniversalRootModel, + parse_obj_as, + universal_field_validator, + universal_root_validator, + update_forward_refs, +) +from .query_encoder import encode_query from .remove_none_from_dict import remove_none_from_dict +from .request_options import RequestOptions +from .serialization import FieldMetadata, convert_and_respect_annotation_metadata __all__ = [ "ApiError", "AsyncClientWrapper", + "AsyncHttpClient", "BaseClientWrapper", + "FieldMetadata", + "File", + "HttpClient", + "IS_PYDANTIC_V2", + "RequestOptions", "SyncClientWrapper", + "UniversalBaseModel", + "UniversalRootModel", + "convert_and_respect_annotation_metadata", + "convert_file_dict_to_httpx_tuples", + "encode_query", "jsonable_encoder", + "parse_obj_as", "remove_none_from_dict", "serialize_datetime", + "universal_field_validator", + "universal_root_validator", + "update_forward_refs", ] diff --git a/src/vocode/core/client_wrapper.py b/src/vocode/core/client_wrapper.py index 5c2e307..4af4767 100644 --- a/src/vocode/core/client_wrapper.py +++ b/src/vocode/core/client_wrapper.py @@ -1,26 +1,36 @@ # This file was auto-generated by Fern from our API Definition. import typing - import httpx +from .http_client import HttpClient +from .http_client import AsyncHttpClient class BaseClientWrapper: - def __init__(self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str): + def __init__( + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + ): self._token = token self._base_url = base_url + self._timeout = timeout def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "vocode-api", - "X-Fern-SDK-Version": "0.0.46", + "X-Fern-SDK-Version": "0.0.47", } - headers["Authorization"] = f"Bearer {self._get_token()}" + token = self._get_token() + if token is not None: + headers["Authorization"] = f"Bearer {token}" return headers - def _get_token(self) -> str: - if isinstance(self._token, str): + def _get_token(self) -> typing.Optional[str]: + if isinstance(self._token, str) or self._token is None: return self._token else: return self._token() @@ -28,18 +38,41 @@ def _get_token(self) -> str: def get_base_url(self) -> str: return self._base_url + def get_timeout(self) -> typing.Optional[float]: + return self._timeout + class SyncClientWrapper(BaseClientWrapper): def __init__( - self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.Client + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + httpx_client: httpx.Client, ): - super().__init__(token=token, base_url=base_url) - self.httpx_client = httpx_client + super().__init__(token=token, base_url=base_url, timeout=timeout) + self.httpx_client = HttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers(), + base_timeout=self.get_timeout(), + base_url=self.get_base_url(), + ) class AsyncClientWrapper(BaseClientWrapper): def __init__( - self, *, token: typing.Union[str, typing.Callable[[], str]], base_url: str, httpx_client: httpx.AsyncClient + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + httpx_client: httpx.AsyncClient, ): - super().__init__(token=token, base_url=base_url) - self.httpx_client = httpx_client + super().__init__(token=token, base_url=base_url, timeout=timeout) + self.httpx_client = AsyncHttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers(), + base_timeout=self.get_timeout(), + base_url=self.get_base_url(), + ) diff --git a/src/vocode/core/file.py b/src/vocode/core/file.py new file mode 100644 index 0000000..6e0f92b --- /dev/null +++ b/src/vocode/core/file.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +# File typing inspired by the flexibility of types within the httpx library +# https://github.com/encode/httpx/blob/master/httpx/_types.py +FileContent = typing.Union[typing.IO[bytes], bytes, str] +File = typing.Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + typing.Tuple[typing.Optional[str], FileContent], + # (filename, file (or bytes), content_type) + typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]], + # (filename, file (or bytes), content_type, headers) + typing.Tuple[ + typing.Optional[str], + FileContent, + typing.Optional[str], + typing.Mapping[str, str], + ], +] + + +def convert_file_dict_to_httpx_tuples( + d: typing.Dict[str, typing.Union[File, typing.List[File]]], +) -> typing.List[typing.Tuple[str, File]]: + """ + The format we use is a list of tuples, where the first element is the + name of the file and the second is the file object. Typically HTTPX wants + a dict, but to be able to send lists of files, you have to use the list + approach (which also works for non-lists) + https://github.com/encode/httpx/pull/1032 + """ + + httpx_tuples = [] + for key, file_like in d.items(): + if isinstance(file_like, list): + for file_like_item in file_like: + httpx_tuples.append((key, file_like_item)) + else: + httpx_tuples.append((key, file_like)) + return httpx_tuples diff --git a/src/vocode/core/http_client.py b/src/vocode/core/http_client.py new file mode 100644 index 0000000..b07401b --- /dev/null +++ b/src/vocode/core/http_client.py @@ -0,0 +1,477 @@ +# This file was auto-generated by Fern from our API Definition. + +import asyncio +import email.utils +import json +import re +import time +import typing +import urllib.parse +from contextlib import asynccontextmanager, contextmanager +from random import random + +import httpx + +from .file import File, convert_file_dict_to_httpx_tuples +from .jsonable_encoder import jsonable_encoder +from .query_encoder import encode_query +from .remove_none_from_dict import remove_none_from_dict +from .request_options import RequestOptions + +INITIAL_RETRY_DELAY_SECONDS = 0.5 +MAX_RETRY_DELAY_SECONDS = 10 +MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 + + +def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait. + + Inspired by the urllib3 retry implementation. + """ + retry_after_ms = response_headers.get("retry-after-ms") + if retry_after_ms is not None: + try: + return int(retry_after_ms) / 1000 if retry_after_ms > 0 else 0 + except Exception: + pass + + retry_after = response_headers.get("retry-after") + if retry_after is None: + return None + + # Attempt to parse the header as an int. + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = float(retry_after) + # Fallback to parsing it as a date. + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + return None + if retry_date_tuple[9] is None: # Python 2 + # Assume UTC if no timezone was specified + # On Python2.7, parsedate_tz returns None for a timezone offset + # instead of 0 if no timezone is given, where mktime_tz treats + # a None timezone offset as local time. + retry_date_tuple = retry_date_tuple[:9] + (0,) + retry_date_tuple[10:] + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + if seconds < 0: + seconds = 0 + + return seconds + + +def _retry_timeout(response: httpx.Response, retries: int) -> float: + """ + Determine the amount of time to wait before retrying a request. + This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff + with a jitter to determine the number of seconds to wait. + """ + + # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + retry_after = _parse_retry_after(response.headers) + if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: + return retry_after + + # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. + retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + + # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. + timeout = retry_delay * (1 - 0.25 * random()) + return timeout if timeout >= 0 else 0 + + +def _should_retry(response: httpx.Response) -> bool: + retriable_400s = [429, 408, 409] + return response.status_code >= 500 or response.status_code in retriable_400s + + +def remove_omit_from_dict( + original: typing.Dict[str, typing.Optional[typing.Any]], + omit: typing.Optional[typing.Any], +) -> typing.Dict[str, typing.Any]: + if omit is None: + return original + new: typing.Dict[str, typing.Any] = {} + for key, value in original.items(): + if value is not omit: + new[key] = value + return new + + +def maybe_filter_request_body( + data: typing.Optional[typing.Any], + request_options: typing.Optional[RequestOptions], + omit: typing.Optional[typing.Any], +) -> typing.Optional[typing.Any]: + if data is None: + return ( + jsonable_encoder(request_options.get("additional_body_parameters", {})) or {} + if request_options is not None + else None + ) + elif not isinstance(data, typing.Mapping): + data_content = jsonable_encoder(data) + else: + data_content = { + **(jsonable_encoder(remove_omit_from_dict(data, omit))), # type: ignore + **( + jsonable_encoder(request_options.get("additional_body_parameters", {})) or {} + if request_options is not None + else {} + ), + } + return data_content + + +# Abstracted out for testing purposes +def get_request_body( + *, + json: typing.Optional[typing.Any], + data: typing.Optional[typing.Any], + request_options: typing.Optional[RequestOptions], + omit: typing.Optional[typing.Any], +) -> typing.Tuple[typing.Optional[typing.Any], typing.Optional[typing.Any]]: + json_body = None + data_body = None + if data is not None: + data_body = maybe_filter_request_body(data, request_options, omit) + else: + # If both data and json are None, we send json data in the event extra properties are specified + json_body = maybe_filter_request_body(json, request_options, omit) + + # If you have an empty JSON body, you should just send None + return (json_body if json_body != {} else None), data_body if data_body != {} else None + + +class HttpClient: + def __init__( + self, + *, + httpx_client: httpx.Client, + base_timeout: typing.Optional[float], + base_headers: typing.Dict[str, str], + base_url: typing.Optional[str] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.httpx_client = httpx_client + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = self.base_url if maybe_base_url is None else maybe_base_url + if base_url is None: + raise ValueError("A base_url is required to make this request, please provide one and try again.") + return base_url + + def request( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> httpx.Response: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + response = self.httpx_client.request( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + if _should_retry(response=response): + if max_retries > retries: + time.sleep(_retry_timeout(response=response, retries=retries)) + return self.request( + path=path, + method=method, + base_url=base_url, + params=params, + json=json, + content=content, + files=files, + headers=headers, + request_options=request_options, + retries=retries + 1, + omit=omit, + ) + + return response + + @contextmanager + def stream( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> typing.Iterator[httpx.Response]: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + with self.httpx_client.stream( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) as stream: + yield stream + + +class AsyncHttpClient: + def __init__( + self, + *, + httpx_client: httpx.AsyncClient, + base_timeout: typing.Optional[float], + base_headers: typing.Dict[str, str], + base_url: typing.Optional[str] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.httpx_client = httpx_client + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = self.base_url if maybe_base_url is None else maybe_base_url + if base_url is None: + raise ValueError("A base_url is required to make this request, please provide one and try again.") + return base_url + + async def request( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> httpx.Response: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + # Add the input to each of these and do None-safety checks + response = await self.httpx_client.request( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + if _should_retry(response=response): + if max_retries > retries: + await asyncio.sleep(_retry_timeout(response=response, retries=retries)) + return await self.request( + path=path, + method=method, + base_url=base_url, + params=params, + json=json, + content=content, + files=files, + headers=headers, + request_options=request_options, + retries=retries + 1, + omit=omit, + ) + return response + + @asynccontextmanager + async def stream( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> typing.AsyncIterator[httpx.Response]: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + async with self.httpx_client.stream( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit=omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) as stream: + yield stream diff --git a/src/vocode/core/jsonable_encoder.py b/src/vocode/core/jsonable_encoder.py index 37238ab..1b631e9 100644 --- a/src/vocode/core/jsonable_encoder.py +++ b/src/vocode/core/jsonable_encoder.py @@ -8,37 +8,27 @@ https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py """ +import base64 import dataclasses import datetime as dt -from collections import defaultdict from enum import Enum from pathlib import PurePath from types import GeneratorType -from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Set, Union -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import pydantic from .datetime_utils import serialize_datetime +from .pydantic_utilities import ( + IS_PYDANTIC_V2, + encode_by_type, + to_jsonable_with_fallback, +) SetIntStr = Set[Union[int, str]] DictIntStrAny = Dict[Union[int, str], Any] -def generate_encoders_by_class_tuples( - type_encoder_map: Dict[Any, Callable[[Any], Any]] -) -> Dict[Callable[[Any], Any], Tuple[Any, ...]]: - encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple) - for type_, encoder in type_encoder_map.items(): - encoders_by_class_tuples[encoder] += (type_,) - return encoders_by_class_tuples - - -encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE) - - def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: custom_encoder = custom_encoder or {} if custom_encoder: @@ -49,26 +39,33 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] if isinstance(obj, encoder_type): return encoder_instance(obj) if isinstance(obj, pydantic.BaseModel): - encoder = getattr(obj.__config__, "json_encoders", {}) + if IS_PYDANTIC_V2: + encoder = getattr(obj.model_config, "json_encoders", {}) # type: ignore # Pydantic v2 + else: + encoder = getattr(obj.__config__, "json_encoders", {}) # type: ignore # Pydantic v1 if custom_encoder: encoder.update(custom_encoder) obj_dict = obj.dict(by_alias=True) if "__root__" in obj_dict: obj_dict = obj_dict["__root__"] + if "root" in obj_dict: + obj_dict = obj_dict["root"] return jsonable_encoder(obj_dict, custom_encoder=encoder) if dataclasses.is_dataclass(obj): - obj_dict = dataclasses.asdict(obj) + obj_dict = dataclasses.asdict(obj) # type: ignore return jsonable_encoder(obj_dict, custom_encoder=custom_encoder) + if isinstance(obj, bytes): + return base64.b64encode(obj).decode("utf-8") if isinstance(obj, Enum): return obj.value if isinstance(obj, PurePath): return str(obj) if isinstance(obj, (str, int, float, type(None))): return obj - if isinstance(obj, dt.date): - return str(obj) if isinstance(obj, dt.datetime): return serialize_datetime(obj) + if isinstance(obj, dt.date): + return str(obj) if isinstance(obj, dict): encoded_dict = {} allowed_keys = set(obj.keys()) @@ -84,20 +81,21 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) return encoded_list - if type(obj) in pydantic.json.ENCODERS_BY_TYPE: - return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj) - for encoder, classes_tuple in encoders_by_class_tuples.items(): - if isinstance(obj, classes_tuple): - return encoder(obj) + def fallback_serializer(o: Any) -> Any: + attempt_encode = encode_by_type(o) + if attempt_encode is not None: + return attempt_encode - try: - data = dict(obj) - except Exception as e: - errors: List[Exception] = [] - errors.append(e) try: - data = vars(obj) + data = dict(o) except Exception as e: + errors: List[Exception] = [] errors.append(e) - raise ValueError(errors) from e - return jsonable_encoder(data, custom_encoder=custom_encoder) + try: + data = vars(o) + except Exception as e: + errors.append(e) + raise ValueError(errors) from e + return jsonable_encoder(data, custom_encoder=custom_encoder) + + return to_jsonable_with_fallback(obj, fallback_serializer) diff --git a/src/vocode/core/pydantic_utilities.py b/src/vocode/core/pydantic_utilities.py new file mode 100644 index 0000000..eb42918 --- /dev/null +++ b/src/vocode/core/pydantic_utilities.py @@ -0,0 +1,206 @@ +# This file was auto-generated by Fern from our API Definition. + +# nopycln: file +import datetime as dt +import typing +from collections import defaultdict + +import typing_extensions + +import pydantic + +from .datetime_utils import serialize_datetime + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +if IS_PYDANTIC_V2: + # isort will try to reformat the comments on these imports, which breaks mypy + # isort: off + from pydantic.v1.datetime_parse import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_date as parse_date, + ) + from pydantic.v1.datetime_parse import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_datetime as parse_datetime, + ) + from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + ENCODERS_BY_TYPE as encoders_by_type, + ) + from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + get_args as get_args, + ) + from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + get_origin as get_origin, + ) + from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + is_literal_type as is_literal_type, + ) + from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + is_union as is_union, + ) + from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 +else: + from pydantic.datetime_parse import parse_date as parse_date # type: ignore # Pydantic v1 + from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore # Pydantic v1 + from pydantic.fields import ModelField as ModelField # type: ignore # Pydantic v1 + from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore # Pydantic v1 + from pydantic.typing import get_args as get_args # type: ignore # Pydantic v1 + from pydantic.typing import get_origin as get_origin # type: ignore # Pydantic v1 + from pydantic.typing import is_literal_type as is_literal_type # type: ignore # Pydantic v1 + from pydantic.typing import is_union as is_union # type: ignore # Pydantic v1 + + # isort: on + + +T = typing.TypeVar("T") +Model = typing.TypeVar("Model", bound=pydantic.BaseModel) + + +def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T: + if IS_PYDANTIC_V2: + adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2 + return adapter.validate_python(object_) + else: + return pydantic.parse_obj_as(type_, object_) + + +def to_jsonable_with_fallback( + obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any] +) -> typing.Any: + if IS_PYDANTIC_V2: + from pydantic_core import to_jsonable_python + + return to_jsonable_python(obj, fallback=fallback_serializer) + else: + return fallback_serializer(obj) + + +class UniversalBaseModel(pydantic.BaseModel): + class Config: + populate_by_name = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = { + "by_alias": True, + "exclude_unset": True, + **kwargs, + } + if IS_PYDANTIC_V2: + return super().model_dump_json(**kwargs_with_defaults) # type: ignore # Pydantic v2 + else: + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + """ + Override the default dict method to `exclude_unset` by default. This function patches + `exclude_unset` to work include fields within non-None default values. + """ + _fields_set = self.__fields_set__ + + fields = _get_model_fields(self.__class__) + for name, field in fields.items(): + if name not in _fields_set: + default = _get_field_default(field) + + # If the default values are non-null act like they've been set + # This effectively allows exclude_unset to work like exclude_none where + # the latter passes through intentionally set none values. + if default != None: + _fields_set.add(name) + + kwargs_with_defaults_exclude_unset: typing.Any = { + "by_alias": True, + "exclude_unset": True, + "include": _fields_set, + **kwargs, + } + + if IS_PYDANTIC_V2: + return super().model_dump(**kwargs_with_defaults_exclude_unset) # type: ignore # Pydantic v2 + else: + return super().dict(**kwargs_with_defaults_exclude_unset) + + +if IS_PYDANTIC_V2: + + class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore # Pydantic v2 + pass + + UniversalRootModel: typing_extensions.TypeAlias = V2RootModel # type: ignore +else: + UniversalRootModel: typing_extensions.TypeAlias = UniversalBaseModel # type: ignore + + +def encode_by_type(o: typing.Any) -> typing.Any: + encoders_by_class_tuples: typing.Dict[typing.Callable[[typing.Any], typing.Any], typing.Tuple[typing.Any, ...]] = ( + defaultdict(tuple) + ) + for type_, encoder in encoders_by_type.items(): + encoders_by_class_tuples[encoder] += (type_,) + + if type(o) in encoders_by_type: + return encoders_by_type[type(o)](o) + for encoder, classes_tuple in encoders_by_class_tuples.items(): + if isinstance(o, classes_tuple): + return encoder(o) + + +def update_forward_refs(model: typing.Type["Model"]) -> None: + if IS_PYDANTIC_V2: + model.model_rebuild(raise_errors=False) # type: ignore # Pydantic v2 + else: + model.update_forward_refs() + + +# Mirrors Pydantic's internal typing +AnyCallable = typing.Callable[..., typing.Any] + + +def universal_root_validator( + pre: bool = False, +) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + if IS_PYDANTIC_V2: + return pydantic.model_validator(mode="before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1 + + return decorator + + +def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + if IS_PYDANTIC_V2: + return pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1 + + return decorator + + +PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo] + + +def _get_model_fields( + model: typing.Type["Model"], +) -> typing.Mapping[str, PydanticField]: + if IS_PYDANTIC_V2: + return model.model_fields # type: ignore # Pydantic v2 + else: + return model.__fields__ # type: ignore # Pydantic v1 + + +def _get_field_default(field: PydanticField) -> typing.Any: + try: + value = field.get_default() # type: ignore # Pydantic < v1.10.15 + except: + value = field.default + if IS_PYDANTIC_V2: + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None + return value + return value diff --git a/src/vocode/core/query_encoder.py b/src/vocode/core/query_encoder.py new file mode 100644 index 0000000..3183001 --- /dev/null +++ b/src/vocode/core/query_encoder.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, List, Optional, Tuple + +import pydantic + + +# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict +def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: + result = [] + for k, v in dict_flat.items(): + key = f"{key_prefix}[{k}]" if key_prefix is not None else k + if isinstance(v, dict): + result.extend(traverse_query_dict(v, key)) + elif isinstance(v, list): + for arr_v in v: + if isinstance(arr_v, dict): + result.extend(traverse_query_dict(arr_v, key)) + else: + result.append((key, arr_v)) + else: + result.append((key, v)) + return result + + +def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]: + if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): + if isinstance(query_value, pydantic.BaseModel): + obj_dict = query_value.dict(by_alias=True) + else: + obj_dict = query_value + return traverse_query_dict(obj_dict, query_key) + elif isinstance(query_value, list): + encoded_values: List[Tuple[str, Any]] = [] + for value in query_value: + if isinstance(value, pydantic.BaseModel) or isinstance(value, dict): + if isinstance(value, pydantic.BaseModel): + obj_dict = value.dict(by_alias=True) + elif isinstance(value, dict): + obj_dict = value + + encoded_values.extend(single_query_encoder(query_key, obj_dict)) + else: + encoded_values.append((query_key, value)) + + return encoded_values + + return [(query_key, query_value)] + + +def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: + if query is None: + return None + + encoded_query = [] + for k, v in query.items(): + encoded_query.extend(single_query_encoder(k, v)) + return encoded_query diff --git a/src/vocode/core/remove_none_from_dict.py b/src/vocode/core/remove_none_from_dict.py index 2da30f7..c229814 100644 --- a/src/vocode/core/remove_none_from_dict.py +++ b/src/vocode/core/remove_none_from_dict.py @@ -1,9 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -from typing import Any, Dict, Optional +from typing import Any, Dict, Mapping, Optional -def remove_none_from_dict(original: Dict[str, Optional[Any]]) -> Dict[str, Any]: +def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]: new: Dict[str, Any] = {} for key, value in original.items(): if value is not None: diff --git a/src/vocode/core/request_options.py b/src/vocode/core/request_options.py new file mode 100644 index 0000000..d0bf0db --- /dev/null +++ b/src/vocode/core/request_options.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +try: + from typing import NotRequired # type: ignore +except ImportError: + from typing_extensions import NotRequired + + +class RequestOptions(typing.TypedDict, total=False): + """ + Additional options for request-specific configuration when calling APIs via the SDK. + This is used primarily as an optional final parameter for service functions. + + Attributes: + - timeout_in_seconds: int. The number of seconds to await an API call before timing out. + + - max_retries: int. The max number of retries to attempt if the API call fails. + + - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict + + - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict + + - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict + """ + + timeout_in_seconds: NotRequired[int] + max_retries: NotRequired[int] + additional_headers: NotRequired[typing.Dict[str, typing.Any]] + additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] + additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] diff --git a/src/vocode/core/serialization.py b/src/vocode/core/serialization.py new file mode 100644 index 0000000..36180ac --- /dev/null +++ b/src/vocode/core/serialization.py @@ -0,0 +1,170 @@ +# This file was auto-generated by Fern from our API Definition. + +import collections +import typing + +import typing_extensions + + +class FieldMetadata: + """ + Metadata class used to annotate fields to provide additional information. + + Example: + class MyDict(TypedDict): + field: typing.Annotated[str, FieldMetadata(alias="field_name")] + + Will serialize: `{"field": "value"}` + To: `{"field_name": "value"}` + """ + + alias: str + + def __init__(self, *, alias: str) -> None: + self.alias = alias + + +def convert_and_respect_annotation_metadata( + *, + object_: typing.Any, + annotation: typing.Any, + inner_type: typing.Optional[typing.Any] = None, +) -> typing.Any: + """ + Respect the metadata annotations on a field, such as aliasing. This function effectively + manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for + TypedDicts, which cannot support aliasing out of the box, and can be extended for additional + utilities, such as defaults. + + Parameters + ---------- + object_ : typing.Any + + annotation : type + The type we're looking to apply typing annotations from + + inner_type : typing.Optional[type] + + Returns + ------- + typing.Any + """ + + if object_ is None: + return None + if inner_type is None: + inner_type = annotation + + clean_type = _remove_annotations(inner_type) + if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping): + return _convert_typeddict(object_, clean_type) + + if ( + # If you're iterating on a string, do not bother to coerce it to a sequence. + (not isinstance(object_, str)) + and ( + ( + ( + typing_extensions.get_origin(clean_type) == typing.List + or typing_extensions.get_origin(clean_type) == list + or clean_type == typing.List + ) + and isinstance(object_, typing.List) + ) + or ( + ( + typing_extensions.get_origin(clean_type) == typing.Set + or typing_extensions.get_origin(clean_type) == set + or clean_type == typing.Set + ) + and isinstance(object_, typing.Set) + ) + or ( + ( + typing_extensions.get_origin(clean_type) == typing.Sequence + or typing_extensions.get_origin(clean_type) == collections.abc.Sequence + or clean_type == typing.Sequence + ) + and isinstance(object_, typing.Sequence) + ) + ) + ): + inner_type = typing_extensions.get_args(clean_type)[0] + return [ + convert_and_respect_annotation_metadata(object_=item, annotation=annotation, inner_type=inner_type) + for item in object_ + ] + + if typing_extensions.get_origin(clean_type) == typing.Union: + # We should be able to ~relatively~ safely try to convert keys against all + # member types in the union, the edge case here is if one member aliases a field + # of the same name to a different name from another member + # Or if another member aliases a field of the same name that another member does not. + for member in typing_extensions.get_args(clean_type): + object_ = convert_and_respect_annotation_metadata(object_=object_, annotation=annotation, inner_type=member) + return object_ + + annotated_type = _get_annotation(annotation) + if annotated_type is None: + return object_ + + # If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.) + # Then we can safely call it on the recursive conversion. + return object_ + + +def _convert_typeddict(object_: typing.Mapping[str, object], expected_type: typing.Any) -> typing.Mapping[str, object]: + converted_object: typing.Dict[str, object] = {} + annotations = typing_extensions.get_type_hints(expected_type, include_extras=True) + for key, value in object_.items(): + type_ = annotations.get(key) + if type_ is None: + converted_object[key] = value + else: + converted_object[_alias_key(key, type_)] = convert_and_respect_annotation_metadata( + object_=value, annotation=type_ + ) + return converted_object + + +def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]: + maybe_annotated_type = typing_extensions.get_origin(type_) + if maybe_annotated_type is None: + return None + + if maybe_annotated_type == typing_extensions.NotRequired: + type_ = typing_extensions.get_args(type_)[0] + maybe_annotated_type = typing_extensions.get_origin(type_) + + if maybe_annotated_type == typing_extensions.Annotated: + return type_ + + return None + + +def _remove_annotations(type_: typing.Any) -> typing.Any: + maybe_annotated_type = typing_extensions.get_origin(type_) + if maybe_annotated_type is None: + return type_ + + if maybe_annotated_type == typing_extensions.NotRequired: + return _remove_annotations(typing_extensions.get_args(type_)[0]) + + if maybe_annotated_type == typing_extensions.Annotated: + return _remove_annotations(typing_extensions.get_args(type_)[0]) + + return type_ + + +def _alias_key(key: str, type_: typing.Any) -> str: + maybe_annotated_type = _get_annotation(type_) + + if maybe_annotated_type is not None: + # The actual annotations are 1 onward, the first is the annotated type + annotations = typing_extensions.get_args(maybe_annotated_type)[1:] + + for annotation in annotations: + if isinstance(annotation, FieldMetadata) and annotation.alias is not None: + return annotation.alias + + return key diff --git a/src/vocode/resources/numbers/__init__.py b/src/vocode/numbers/__init__.py similarity index 61% rename from src/vocode/resources/numbers/__init__.py rename to src/vocode/numbers/__init__.py index abc0a11..2e09c67 100644 --- a/src/vocode/resources/numbers/__init__.py +++ b/src/vocode/numbers/__init__.py @@ -1,6 +1,9 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( + BuyPhoneNumberRequestInboundAgent, + BuyPhoneNumberRequestTelephonyProvider, + LinkPhoneNumberRequestInboundAgent, UpdateNumberRequestExampleContext, UpdateNumberRequestInboundAgent, UpdateNumberRequestLabel, @@ -8,6 +11,9 @@ ) __all__ = [ + "BuyPhoneNumberRequestInboundAgent", + "BuyPhoneNumberRequestTelephonyProvider", + "LinkPhoneNumberRequestInboundAgent", "UpdateNumberRequestExampleContext", "UpdateNumberRequestInboundAgent", "UpdateNumberRequestLabel", diff --git a/src/vocode/numbers/client.py b/src/vocode/numbers/client.py new file mode 100644 index 0000000..ca9a544 --- /dev/null +++ b/src/vocode/numbers/client.py @@ -0,0 +1,919 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.phone_number_page import PhoneNumberPage +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.phone_number import PhoneNumber +from .types.buy_phone_number_request_telephony_provider import BuyPhoneNumberRequestTelephonyProvider +from .types.buy_phone_number_request_inbound_agent import BuyPhoneNumberRequestInboundAgent +from .types.update_number_request_outbound_only import UpdateNumberRequestOutboundOnly +from .types.update_number_request_example_context import UpdateNumberRequestExampleContext +from .types.update_number_request_label import UpdateNumberRequestLabel +from .types.update_number_request_inbound_agent import UpdateNumberRequestInboundAgent +from .types.link_phone_number_request_inbound_agent import LinkPhoneNumberRequestInboundAgent +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class NumbersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_numbers( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumberPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumberPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.list_numbers() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumberPage, + parse_obj_as( + type_=PhoneNumberPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_number(self, *, phone_number: str, request_options: typing.Optional[RequestOptions] = None) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.get_number( + phone_number="phone_number", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers", + method="GET", + params={ + "phone_number": phone_number, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def buy_number( + self, + *, + area_code: typing.Optional[str] = OMIT, + telephony_provider: typing.Optional[BuyPhoneNumberRequestTelephonyProvider] = OMIT, + telephony_account_connection: typing.Optional[str] = OMIT, + inbound_agent: typing.Optional[BuyPhoneNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + area_code : typing.Optional[str] + + telephony_provider : typing.Optional[BuyPhoneNumberRequestTelephonyProvider] + + telephony_account_connection : typing.Optional[str] + + inbound_agent : typing.Optional[BuyPhoneNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.buy_number() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers/buy", + method="POST", + json={ + "area_code": area_code, + "telephony_provider": telephony_provider, + "telephony_account_connection": telephony_account_connection, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_number( + self, + *, + phone_number: str, + outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly] = OMIT, + example_context: typing.Optional[UpdateNumberRequestExampleContext] = OMIT, + label: typing.Optional[UpdateNumberRequestLabel] = OMIT, + inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + outbound_only : typing.Optional[UpdateNumberRequestOutboundOnly] + + example_context : typing.Optional[UpdateNumberRequestExampleContext] + + label : typing.Optional[UpdateNumberRequestLabel] + + inbound_agent : typing.Optional[UpdateNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.update_number( + phone_number="phone_number", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers/update", + method="POST", + params={ + "phone_number": phone_number, + }, + json={ + "outbound_only": outbound_only, + "example_context": example_context, + "label": label, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def cancel_number( + self, *, phone_number: str, request_options: typing.Optional[RequestOptions] = None + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.cancel_number( + phone_number="phone_number", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers/cancel", + method="POST", + params={ + "phone_number": phone_number, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def link_number( + self, + *, + phone_number: str, + telephony_account_connection: str, + outbound_only: typing.Optional[bool] = OMIT, + inbound_agent: typing.Optional[LinkPhoneNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + telephony_account_connection : str + + outbound_only : typing.Optional[bool] + + inbound_agent : typing.Optional[LinkPhoneNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.numbers.link_number( + phone_number="phone_number", + telephony_account_connection="telephony_account_connection", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/numbers/link", + method="POST", + json={ + "phone_number": phone_number, + "telephony_account_connection": telephony_account_connection, + "outbound_only": outbound_only, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncNumbersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_numbers( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumberPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumberPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.list_numbers() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumberPage, + parse_obj_as( + type_=PhoneNumberPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_number( + self, *, phone_number: str, request_options: typing.Optional[RequestOptions] = None + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.get_number( + phone_number="phone_number", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers", + method="GET", + params={ + "phone_number": phone_number, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def buy_number( + self, + *, + area_code: typing.Optional[str] = OMIT, + telephony_provider: typing.Optional[BuyPhoneNumberRequestTelephonyProvider] = OMIT, + telephony_account_connection: typing.Optional[str] = OMIT, + inbound_agent: typing.Optional[BuyPhoneNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + area_code : typing.Optional[str] + + telephony_provider : typing.Optional[BuyPhoneNumberRequestTelephonyProvider] + + telephony_account_connection : typing.Optional[str] + + inbound_agent : typing.Optional[BuyPhoneNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.buy_number() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers/buy", + method="POST", + json={ + "area_code": area_code, + "telephony_provider": telephony_provider, + "telephony_account_connection": telephony_account_connection, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_number( + self, + *, + phone_number: str, + outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly] = OMIT, + example_context: typing.Optional[UpdateNumberRequestExampleContext] = OMIT, + label: typing.Optional[UpdateNumberRequestLabel] = OMIT, + inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + outbound_only : typing.Optional[UpdateNumberRequestOutboundOnly] + + example_context : typing.Optional[UpdateNumberRequestExampleContext] + + label : typing.Optional[UpdateNumberRequestLabel] + + inbound_agent : typing.Optional[UpdateNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.update_number( + phone_number="phone_number", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers/update", + method="POST", + params={ + "phone_number": phone_number, + }, + json={ + "outbound_only": outbound_only, + "example_context": example_context, + "label": label, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def cancel_number( + self, *, phone_number: str, request_options: typing.Optional[RequestOptions] = None + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.cancel_number( + phone_number="phone_number", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers/cancel", + method="POST", + params={ + "phone_number": phone_number, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def link_number( + self, + *, + phone_number: str, + telephony_account_connection: str, + outbound_only: typing.Optional[bool] = OMIT, + inbound_agent: typing.Optional[LinkPhoneNumberRequestInboundAgent] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumber: + """ + Parameters + ---------- + phone_number : str + + telephony_account_connection : str + + outbound_only : typing.Optional[bool] + + inbound_agent : typing.Optional[LinkPhoneNumberRequestInboundAgent] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumber + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.numbers.link_number( + phone_number="phone_number", + telephony_account_connection="telephony_account_connection", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/numbers/link", + method="POST", + json={ + "phone_number": phone_number, + "telephony_account_connection": telephony_account_connection, + "outbound_only": outbound_only, + "inbound_agent": inbound_agent, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PhoneNumber, + parse_obj_as( + type_=PhoneNumber, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/numbers/types/__init__.py b/src/vocode/numbers/types/__init__.py similarity index 57% rename from src/vocode/resources/numbers/types/__init__.py rename to src/vocode/numbers/types/__init__.py index 1aaa6fc..d11d454 100644 --- a/src/vocode/resources/numbers/types/__init__.py +++ b/src/vocode/numbers/types/__init__.py @@ -1,11 +1,17 @@ # This file was auto-generated by Fern from our API Definition. +from .buy_phone_number_request_inbound_agent import BuyPhoneNumberRequestInboundAgent +from .buy_phone_number_request_telephony_provider import BuyPhoneNumberRequestTelephonyProvider +from .link_phone_number_request_inbound_agent import LinkPhoneNumberRequestInboundAgent from .update_number_request_example_context import UpdateNumberRequestExampleContext from .update_number_request_inbound_agent import UpdateNumberRequestInboundAgent from .update_number_request_label import UpdateNumberRequestLabel from .update_number_request_outbound_only import UpdateNumberRequestOutboundOnly __all__ = [ + "BuyPhoneNumberRequestInboundAgent", + "BuyPhoneNumberRequestTelephonyProvider", + "LinkPhoneNumberRequestInboundAgent", "UpdateNumberRequestExampleContext", "UpdateNumberRequestInboundAgent", "UpdateNumberRequestLabel", diff --git a/src/vocode/numbers/types/buy_phone_number_request_inbound_agent.py b/src/vocode/numbers/types/buy_phone_number_request_inbound_agent.py new file mode 100644 index 0000000..fb9f31e --- /dev/null +++ b/src/vocode/numbers/types/buy_phone_number_request_inbound_agent.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ...types.agent_params import AgentParams + +BuyPhoneNumberRequestInboundAgent = typing.Union[AgentParams, str, typing.Literal["default"]] diff --git a/src/vocode/numbers/types/buy_phone_number_request_telephony_provider.py b/src/vocode/numbers/types/buy_phone_number_request_telephony_provider.py new file mode 100644 index 0000000..8b5e6bb --- /dev/null +++ b/src/vocode/numbers/types/buy_phone_number_request_telephony_provider.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BuyPhoneNumberRequestTelephonyProvider = typing.Union[typing.Literal["vonage", "twilio"], typing.Any] diff --git a/src/vocode/numbers/types/link_phone_number_request_inbound_agent.py b/src/vocode/numbers/types/link_phone_number_request_inbound_agent.py new file mode 100644 index 0000000..aa1b154 --- /dev/null +++ b/src/vocode/numbers/types/link_phone_number_request_inbound_agent.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ...types.agent_params import AgentParams + +LinkPhoneNumberRequestInboundAgent = typing.Union[AgentParams, str, typing.Literal["default"]] diff --git a/src/vocode/resources/numbers/types/update_number_request_example_context.py b/src/vocode/numbers/types/update_number_request_example_context.py similarity index 79% rename from src/vocode/resources/numbers/types/update_number_request_example_context.py rename to src/vocode/numbers/types/update_number_request_example_context.py index 3895f2c..bbe1ddf 100644 --- a/src/vocode/resources/numbers/types/update_number_request_example_context.py +++ b/src/vocode/numbers/types/update_number_request_example_context.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.undefined import Undefined +from ...types.undefined import Undefined UpdateNumberRequestExampleContext = typing.Union[typing.Dict[str, str], Undefined] diff --git a/src/vocode/numbers/types/update_number_request_inbound_agent.py b/src/vocode/numbers/types/update_number_request_inbound_agent.py new file mode 100644 index 0000000..ca6e480 --- /dev/null +++ b/src/vocode/numbers/types/update_number_request_inbound_agent.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ...types.agent_update_params import AgentUpdateParams +from ...types.undefined import Undefined + +UpdateNumberRequestInboundAgent = typing.Union[AgentUpdateParams, str, Undefined] diff --git a/src/vocode/resources/numbers/types/update_number_request_label.py b/src/vocode/numbers/types/update_number_request_label.py similarity index 75% rename from src/vocode/resources/numbers/types/update_number_request_label.py rename to src/vocode/numbers/types/update_number_request_label.py index 3a52a32..9d22746 100644 --- a/src/vocode/resources/numbers/types/update_number_request_label.py +++ b/src/vocode/numbers/types/update_number_request_label.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.undefined import Undefined +from ...types.undefined import Undefined UpdateNumberRequestLabel = typing.Union[str, Undefined] diff --git a/src/vocode/resources/numbers/types/update_number_request_outbound_only.py b/src/vocode/numbers/types/update_number_request_outbound_only.py similarity index 77% rename from src/vocode/resources/numbers/types/update_number_request_outbound_only.py rename to src/vocode/numbers/types/update_number_request_outbound_only.py index d91cd22..ff34b80 100644 --- a/src/vocode/resources/numbers/types/update_number_request_outbound_only.py +++ b/src/vocode/numbers/types/update_number_request_outbound_only.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.undefined import Undefined +from ...types.undefined import Undefined UpdateNumberRequestOutboundOnly = typing.Union[bool, Undefined] diff --git a/src/vocode/resources/usage/__init__.py b/src/vocode/prompts/__init__.py similarity index 100% rename from src/vocode/resources/usage/__init__.py rename to src/vocode/prompts/__init__.py diff --git a/src/vocode/prompts/client.py b/src/vocode/prompts/client.py new file mode 100644 index 0000000..7ea2968 --- /dev/null +++ b/src/vocode/prompts/client.py @@ -0,0 +1,630 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.prompt import Prompt +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.prompt_page import PromptPage +from ..types.collect_field import CollectField +from ..types.prompt_params_prompt_template import PromptParamsPromptTemplate +from ..types.prompt_update_params_content import PromptUpdateParamsContent +from ..types.prompt_update_params_collect_fields import PromptUpdateParamsCollectFields +from ..types.prompt_update_params_context_endpoint import PromptUpdateParamsContextEndpoint +from ..types.prompt_update_params_prompt_template import PromptUpdateParamsPromptTemplate +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PromptsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_prompt(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Prompt: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.prompts.get_prompt( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/prompts", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_prompts( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PromptPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PromptPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.prompts.list_prompts() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/prompts/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PromptPage, + parse_obj_as( + type_=PromptPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_prompt( + self, + *, + content: typing.Optional[str] = OMIT, + collect_fields: typing.Optional[typing.Sequence[CollectField]] = OMIT, + context_endpoint: typing.Optional[str] = OMIT, + prompt_template: typing.Optional[PromptParamsPromptTemplate] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Prompt: + """ + Parameters + ---------- + content : typing.Optional[str] + + collect_fields : typing.Optional[typing.Sequence[CollectField]] + + context_endpoint : typing.Optional[str] + + prompt_template : typing.Optional[PromptParamsPromptTemplate] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.prompts.create_prompt() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/prompts/create", + method="POST", + json={ + "content": content, + "collect_fields": collect_fields, + "context_endpoint": context_endpoint, + "prompt_template": prompt_template, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_prompt( + self, + *, + id: str, + content: typing.Optional[PromptUpdateParamsContent] = OMIT, + collect_fields: typing.Optional[PromptUpdateParamsCollectFields] = OMIT, + context_endpoint: typing.Optional[PromptUpdateParamsContextEndpoint] = OMIT, + prompt_template: typing.Optional[PromptUpdateParamsPromptTemplate] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Prompt: + """ + Parameters + ---------- + id : str + + content : typing.Optional[PromptUpdateParamsContent] + + collect_fields : typing.Optional[PromptUpdateParamsCollectFields] + + context_endpoint : typing.Optional[PromptUpdateParamsContextEndpoint] + + prompt_template : typing.Optional[PromptUpdateParamsPromptTemplate] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.prompts.update_prompt( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/prompts/update", + method="POST", + params={ + "id": id, + }, + json={ + "content": content, + "collect_fields": collect_fields, + "context_endpoint": context_endpoint, + "prompt_template": prompt_template, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncPromptsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_prompt(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Prompt: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.prompts.get_prompt( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/prompts", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_prompts( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PromptPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PromptPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.prompts.list_prompts() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/prompts/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PromptPage, + parse_obj_as( + type_=PromptPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_prompt( + self, + *, + content: typing.Optional[str] = OMIT, + collect_fields: typing.Optional[typing.Sequence[CollectField]] = OMIT, + context_endpoint: typing.Optional[str] = OMIT, + prompt_template: typing.Optional[PromptParamsPromptTemplate] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Prompt: + """ + Parameters + ---------- + content : typing.Optional[str] + + collect_fields : typing.Optional[typing.Sequence[CollectField]] + + context_endpoint : typing.Optional[str] + + prompt_template : typing.Optional[PromptParamsPromptTemplate] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.prompts.create_prompt() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/prompts/create", + method="POST", + json={ + "content": content, + "collect_fields": collect_fields, + "context_endpoint": context_endpoint, + "prompt_template": prompt_template, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_prompt( + self, + *, + id: str, + content: typing.Optional[PromptUpdateParamsContent] = OMIT, + collect_fields: typing.Optional[PromptUpdateParamsCollectFields] = OMIT, + context_endpoint: typing.Optional[PromptUpdateParamsContextEndpoint] = OMIT, + prompt_template: typing.Optional[PromptUpdateParamsPromptTemplate] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Prompt: + """ + Parameters + ---------- + id : str + + content : typing.Optional[PromptUpdateParamsContent] + + collect_fields : typing.Optional[PromptUpdateParamsCollectFields] + + context_endpoint : typing.Optional[PromptUpdateParamsContextEndpoint] + + prompt_template : typing.Optional[PromptUpdateParamsPromptTemplate] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Prompt + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.prompts.update_prompt( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/prompts/update", + method="POST", + params={ + "id": id, + }, + json={ + "content": content, + "collect_fields": collect_fields, + "context_endpoint": context_endpoint, + "prompt_template": prompt_template, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Prompt, + parse_obj_as( + type_=Prompt, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/__init__.py b/src/vocode/resources/__init__.py deleted file mode 100644 index 8fae752..0000000 --- a/src/vocode/resources/__init__.py +++ /dev/null @@ -1,71 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from . import account_connections, actions, agents, calls, numbers, prompts, usage, vector_databases, voices, webhooks -from .agents import ( - AgentParamsActionsItem, - AgentParamsActionsItemOne, - AgentParamsActionsItemOne_ActionAddToConference, - AgentParamsActionsItemOne_ActionDtmf, - AgentParamsActionsItemOne_ActionEndConversation, - AgentParamsActionsItemOne_ActionExternal, - AgentParamsActionsItemOne_ActionSetHold, - AgentParamsActionsItemOne_ActionTransferCall, - AgentParamsEndpointingSensitivity, - AgentParamsIvrNavigationMode, - AgentParamsOpenaiAccountConnection, - AgentParamsPrompt, - AgentParamsVectorDatabase, - AgentParamsVoice, - AgentParamsVoiceOne, - AgentParamsVoiceOne_VoiceAzure, - AgentParamsVoiceOne_VoiceElevenLabs, - AgentParamsVoiceOne_VoicePlayHt, - AgentParamsVoiceOne_VoiceRime, - AgentParamsWebhook, -) -from .calls import CreateCallRequestAgent, CreateCallRequestOnNoHumanAnswer -from .numbers import ( - UpdateNumberRequestExampleContext, - UpdateNumberRequestInboundAgent, - UpdateNumberRequestLabel, - UpdateNumberRequestOutboundOnly, -) - -__all__ = [ - "AgentParamsActionsItem", - "AgentParamsActionsItemOne", - "AgentParamsActionsItemOne_ActionAddToConference", - "AgentParamsActionsItemOne_ActionDtmf", - "AgentParamsActionsItemOne_ActionEndConversation", - "AgentParamsActionsItemOne_ActionExternal", - "AgentParamsActionsItemOne_ActionSetHold", - "AgentParamsActionsItemOne_ActionTransferCall", - "AgentParamsEndpointingSensitivity", - "AgentParamsIvrNavigationMode", - "AgentParamsOpenaiAccountConnection", - "AgentParamsPrompt", - "AgentParamsVectorDatabase", - "AgentParamsVoice", - "AgentParamsVoiceOne", - "AgentParamsVoiceOne_VoiceAzure", - "AgentParamsVoiceOne_VoiceElevenLabs", - "AgentParamsVoiceOne_VoicePlayHt", - "AgentParamsVoiceOne_VoiceRime", - "AgentParamsWebhook", - "CreateCallRequestAgent", - "CreateCallRequestOnNoHumanAnswer", - "UpdateNumberRequestExampleContext", - "UpdateNumberRequestInboundAgent", - "UpdateNumberRequestLabel", - "UpdateNumberRequestOutboundOnly", - "account_connections", - "actions", - "agents", - "calls", - "numbers", - "prompts", - "usage", - "vector_databases", - "voices", - "webhooks", -] diff --git a/src/vocode/resources/account_connections/client.py b/src/vocode/resources/account_connections/client.py deleted file mode 100644 index 99cd8e1..0000000 --- a/src/vocode/resources/account_connections/client.py +++ /dev/null @@ -1,360 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.account_connection_page import AccountConnectionPage -from ...types.account_connection_params_request import AccountConnectionParamsRequest -from ...types.account_connection_response_model import AccountConnectionResponseModel -from ...types.account_connection_update_params_request import AccountConnectionUpdateParamsRequest -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class AccountConnectionsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_account_connection(self, *, id: str) -> AccountConnectionResponseModel: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_account_connections( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> AccountConnectionPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_account_connection(self, *, request: AccountConnectionParamsRequest) -> AccountConnectionResponseModel: - """ - Parameters: - - request: AccountConnectionParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_account_connection( - self, *, id: str, request: AccountConnectionUpdateParamsRequest - ) -> AccountConnectionResponseModel: - """ - Parameters: - - id: str. - - - request: AccountConnectionUpdateParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def add_to_steering_pool(self, *, id: str, phone_number: str) -> typing.Any: - """ - Parameters: - - id: str. - - - phone_number: str. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/add_to_steering_pool" - ), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def remove_from_steering_pool(self, *, id: str, phone_number: str) -> typing.Any: - """ - Parameters: - - id: str. - - - phone_number: str. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/remove_from_steering_pool" - ), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncAccountConnectionsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_account_connection(self, *, id: str) -> AccountConnectionResponseModel: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_account_connections( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> AccountConnectionPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_account_connection( - self, *, request: AccountConnectionParamsRequest - ) -> AccountConnectionResponseModel: - """ - Parameters: - - request: AccountConnectionParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_account_connection( - self, *, id: str, request: AccountConnectionUpdateParamsRequest - ) -> AccountConnectionResponseModel: - """ - Parameters: - - id: str. - - - request: AccountConnectionUpdateParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AccountConnectionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add_to_steering_pool(self, *, id: str, phone_number: str) -> typing.Any: - """ - Parameters: - - id: str. - - - phone_number: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/add_to_steering_pool" - ), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def remove_from_steering_pool(self, *, id: str, phone_number: str) -> typing.Any: - """ - Parameters: - - id: str. - - - phone_number: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/account_connections/remove_from_steering_pool" - ), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/actions/client.py b/src/vocode/resources/actions/client.py deleted file mode 100644 index 46dbaf5..0000000 --- a/src/vocode/resources/actions/client.py +++ /dev/null @@ -1,246 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.action_page import ActionPage -from ...types.action_params_request import ActionParamsRequest -from ...types.action_response_model import ActionResponseModel -from ...types.action_update_params_request import ActionUpdateParamsRequest -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class ActionsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_action(self, *, id: str) -> ActionResponseModel: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_actions( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> ActionPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_action(self, *, request: ActionParamsRequest) -> ActionResponseModel: - """ - Parameters: - - request: ActionParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_action(self, *, id: str, request: ActionUpdateParamsRequest) -> ActionResponseModel: - """ - Parameters: - - id: str. - - - request: ActionUpdateParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncActionsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_action(self, *, id: str) -> ActionResponseModel: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_actions( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> ActionPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_action(self, *, request: ActionParamsRequest) -> ActionResponseModel: - """ - Parameters: - - request: ActionParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_action(self, *, id: str, request: ActionUpdateParamsRequest) -> ActionResponseModel: - """ - Parameters: - - id: str. - - - request: ActionUpdateParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/actions/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ActionResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/agents/__init__.py b/src/vocode/resources/agents/__init__.py deleted file mode 100644 index 903cf98..0000000 --- a/src/vocode/resources/agents/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .types import ( - AgentParamsActionsItem, - AgentParamsActionsItemOne, - AgentParamsActionsItemOne_ActionAddToConference, - AgentParamsActionsItemOne_ActionDtmf, - AgentParamsActionsItemOne_ActionEndConversation, - AgentParamsActionsItemOne_ActionExternal, - AgentParamsActionsItemOne_ActionSetHold, - AgentParamsActionsItemOne_ActionTransferCall, - AgentParamsEndpointingSensitivity, - AgentParamsIvrNavigationMode, - AgentParamsOpenaiAccountConnection, - AgentParamsPrompt, - AgentParamsVectorDatabase, - AgentParamsVoice, - AgentParamsVoiceOne, - AgentParamsVoiceOne_VoiceAzure, - AgentParamsVoiceOne_VoiceElevenLabs, - AgentParamsVoiceOne_VoicePlayHt, - AgentParamsVoiceOne_VoiceRime, - AgentParamsWebhook, -) - -__all__ = [ - "AgentParamsActionsItem", - "AgentParamsActionsItemOne", - "AgentParamsActionsItemOne_ActionAddToConference", - "AgentParamsActionsItemOne_ActionDtmf", - "AgentParamsActionsItemOne_ActionEndConversation", - "AgentParamsActionsItemOne_ActionExternal", - "AgentParamsActionsItemOne_ActionSetHold", - "AgentParamsActionsItemOne_ActionTransferCall", - "AgentParamsEndpointingSensitivity", - "AgentParamsIvrNavigationMode", - "AgentParamsOpenaiAccountConnection", - "AgentParamsPrompt", - "AgentParamsVectorDatabase", - "AgentParamsVoice", - "AgentParamsVoiceOne", - "AgentParamsVoiceOne_VoiceAzure", - "AgentParamsVoiceOne_VoiceElevenLabs", - "AgentParamsVoiceOne_VoicePlayHt", - "AgentParamsVoiceOne_VoiceRime", - "AgentParamsWebhook", -] diff --git a/src/vocode/resources/agents/client.py b/src/vocode/resources/agents/client.py deleted file mode 100644 index b02eca9..0000000 --- a/src/vocode/resources/agents/client.py +++ /dev/null @@ -1,451 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.agent import Agent -from ...types.agent_page import AgentPage -from ...types.agent_update_params import AgentUpdateParams -from ...types.http_validation_error import HttpValidationError -from ...types.interrupt_sensitivity import InterruptSensitivity -from ...types.language import Language -from .types.agent_params_actions_item import AgentParamsActionsItem -from .types.agent_params_endpointing_sensitivity import AgentParamsEndpointingSensitivity -from .types.agent_params_ivr_navigation_mode import AgentParamsIvrNavigationMode -from .types.agent_params_openai_account_connection import AgentParamsOpenaiAccountConnection -from .types.agent_params_prompt import AgentParamsPrompt -from .types.agent_params_vector_database import AgentParamsVectorDatabase -from .types.agent_params_voice import AgentParamsVoice -from .types.agent_params_webhook import AgentParamsWebhook - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class AgentsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_agent(self, *, id: str) -> Agent: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_agents( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> AgentPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AgentPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_agent( - self, - *, - name: typing.Optional[str] = OMIT, - prompt: AgentParamsPrompt, - language: typing.Optional[Language] = OMIT, - actions: typing.Optional[typing.List[AgentParamsActionsItem]] = OMIT, - voice: AgentParamsVoice, - initial_message: typing.Optional[str] = OMIT, - webhook: typing.Optional[AgentParamsWebhook] = OMIT, - vector_database: typing.Optional[AgentParamsVectorDatabase] = OMIT, - interrupt_sensitivity: typing.Optional[InterruptSensitivity] = OMIT, - context_endpoint: typing.Optional[str] = OMIT, - noise_suppression: typing.Optional[bool] = OMIT, - endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT, - ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT, - conversation_speed: typing.Optional[float] = OMIT, - initial_message_delay: typing.Optional[float] = OMIT, - openai_model_name_override: typing.Optional[str] = OMIT, - ask_if_human_present_on_idle: typing.Optional[bool] = OMIT, - openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection] = OMIT, - run_do_not_call_detection: typing.Optional[bool] = OMIT, - llm_temperature: typing.Optional[float] = OMIT, - ) -> Agent: - """ - Parameters: - - name: typing.Optional[str]. - - - prompt: AgentParamsPrompt. - - - language: typing.Optional[Language]. - - - actions: typing.Optional[typing.List[AgentParamsActionsItem]]. - - - voice: AgentParamsVoice. - - - initial_message: typing.Optional[str]. - - - webhook: typing.Optional[AgentParamsWebhook]. - - - vector_database: typing.Optional[AgentParamsVectorDatabase]. - - - interrupt_sensitivity: typing.Optional[InterruptSensitivity]. - - - context_endpoint: typing.Optional[str]. - - - noise_suppression: typing.Optional[bool]. - - - endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity]. - - - ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode]. - - - conversation_speed: typing.Optional[float]. - - - initial_message_delay: typing.Optional[float]. - - - openai_model_name_override: typing.Optional[str]. - - - ask_if_human_present_on_idle: typing.Optional[bool]. - - - openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection]. - - - run_do_not_call_detection: typing.Optional[bool]. - - - llm_temperature: typing.Optional[float]. - """ - _request: typing.Dict[str, typing.Any] = {"prompt": prompt, "voice": voice} - if name is not OMIT: - _request["name"] = name - if language is not OMIT: - _request["language"] = language - if actions is not OMIT: - _request["actions"] = actions - if initial_message is not OMIT: - _request["initial_message"] = initial_message - if webhook is not OMIT: - _request["webhook"] = webhook - if vector_database is not OMIT: - _request["vector_database"] = vector_database - if interrupt_sensitivity is not OMIT: - _request["interrupt_sensitivity"] = interrupt_sensitivity - if context_endpoint is not OMIT: - _request["context_endpoint"] = context_endpoint - if noise_suppression is not OMIT: - _request["noise_suppression"] = noise_suppression - if endpointing_sensitivity is not OMIT: - _request["endpointing_sensitivity"] = endpointing_sensitivity - if ivr_navigation_mode is not OMIT: - _request["ivr_navigation_mode"] = ivr_navigation_mode - if conversation_speed is not OMIT: - _request["conversation_speed"] = conversation_speed - if initial_message_delay is not OMIT: - _request["initial_message_delay"] = initial_message_delay - if openai_model_name_override is not OMIT: - _request["openai_model_name_override"] = openai_model_name_override - if ask_if_human_present_on_idle is not OMIT: - _request["ask_if_human_present_on_idle"] = ask_if_human_present_on_idle - if openai_account_connection is not OMIT: - _request["openai_account_connection"] = openai_account_connection - if run_do_not_call_detection is not OMIT: - _request["run_do_not_call_detection"] = run_do_not_call_detection - if llm_temperature is not OMIT: - _request["llm_temperature"] = llm_temperature - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/create"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_agent(self, *, id: str, request: AgentUpdateParams) -> Agent: - """ - Parameters: - - id: str. - - - request: AgentUpdateParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncAgentsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_agent(self, *, id: str) -> Agent: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_agents( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> AgentPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AgentPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_agent( - self, - *, - name: typing.Optional[str] = OMIT, - prompt: AgentParamsPrompt, - language: typing.Optional[Language] = OMIT, - actions: typing.Optional[typing.List[AgentParamsActionsItem]] = OMIT, - voice: AgentParamsVoice, - initial_message: typing.Optional[str] = OMIT, - webhook: typing.Optional[AgentParamsWebhook] = OMIT, - vector_database: typing.Optional[AgentParamsVectorDatabase] = OMIT, - interrupt_sensitivity: typing.Optional[InterruptSensitivity] = OMIT, - context_endpoint: typing.Optional[str] = OMIT, - noise_suppression: typing.Optional[bool] = OMIT, - endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT, - ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT, - conversation_speed: typing.Optional[float] = OMIT, - initial_message_delay: typing.Optional[float] = OMIT, - openai_model_name_override: typing.Optional[str] = OMIT, - ask_if_human_present_on_idle: typing.Optional[bool] = OMIT, - openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection] = OMIT, - run_do_not_call_detection: typing.Optional[bool] = OMIT, - llm_temperature: typing.Optional[float] = OMIT, - ) -> Agent: - """ - Parameters: - - name: typing.Optional[str]. - - - prompt: AgentParamsPrompt. - - - language: typing.Optional[Language]. - - - actions: typing.Optional[typing.List[AgentParamsActionsItem]]. - - - voice: AgentParamsVoice. - - - initial_message: typing.Optional[str]. - - - webhook: typing.Optional[AgentParamsWebhook]. - - - vector_database: typing.Optional[AgentParamsVectorDatabase]. - - - interrupt_sensitivity: typing.Optional[InterruptSensitivity]. - - - context_endpoint: typing.Optional[str]. - - - noise_suppression: typing.Optional[bool]. - - - endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity]. - - - ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode]. - - - conversation_speed: typing.Optional[float]. - - - initial_message_delay: typing.Optional[float]. - - - openai_model_name_override: typing.Optional[str]. - - - ask_if_human_present_on_idle: typing.Optional[bool]. - - - openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection]. - - - run_do_not_call_detection: typing.Optional[bool]. - - - llm_temperature: typing.Optional[float]. - """ - _request: typing.Dict[str, typing.Any] = {"prompt": prompt, "voice": voice} - if name is not OMIT: - _request["name"] = name - if language is not OMIT: - _request["language"] = language - if actions is not OMIT: - _request["actions"] = actions - if initial_message is not OMIT: - _request["initial_message"] = initial_message - if webhook is not OMIT: - _request["webhook"] = webhook - if vector_database is not OMIT: - _request["vector_database"] = vector_database - if interrupt_sensitivity is not OMIT: - _request["interrupt_sensitivity"] = interrupt_sensitivity - if context_endpoint is not OMIT: - _request["context_endpoint"] = context_endpoint - if noise_suppression is not OMIT: - _request["noise_suppression"] = noise_suppression - if endpointing_sensitivity is not OMIT: - _request["endpointing_sensitivity"] = endpointing_sensitivity - if ivr_navigation_mode is not OMIT: - _request["ivr_navigation_mode"] = ivr_navigation_mode - if conversation_speed is not OMIT: - _request["conversation_speed"] = conversation_speed - if initial_message_delay is not OMIT: - _request["initial_message_delay"] = initial_message_delay - if openai_model_name_override is not OMIT: - _request["openai_model_name_override"] = openai_model_name_override - if ask_if_human_present_on_idle is not OMIT: - _request["ask_if_human_present_on_idle"] = ask_if_human_present_on_idle - if openai_account_connection is not OMIT: - _request["openai_account_connection"] = openai_account_connection - if run_do_not_call_detection is not OMIT: - _request["run_do_not_call_detection"] = run_do_not_call_detection - if llm_temperature is not OMIT: - _request["llm_temperature"] = llm_temperature - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/create"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_agent(self, *, id: str, request: AgentUpdateParams) -> Agent: - """ - Parameters: - - id: str. - - - request: AgentUpdateParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Agent, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/agents/types/__init__.py b/src/vocode/resources/agents/types/__init__.py deleted file mode 100644 index 39cdd2a..0000000 --- a/src/vocode/resources/agents/types/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .agent_params_actions_item import AgentParamsActionsItem -from .agent_params_actions_item_one import ( - AgentParamsActionsItemOne, - AgentParamsActionsItemOne_ActionAddToConference, - AgentParamsActionsItemOne_ActionDtmf, - AgentParamsActionsItemOne_ActionEndConversation, - AgentParamsActionsItemOne_ActionExternal, - AgentParamsActionsItemOne_ActionSetHold, - AgentParamsActionsItemOne_ActionTransferCall, -) -from .agent_params_endpointing_sensitivity import AgentParamsEndpointingSensitivity -from .agent_params_ivr_navigation_mode import AgentParamsIvrNavigationMode -from .agent_params_openai_account_connection import AgentParamsOpenaiAccountConnection -from .agent_params_prompt import AgentParamsPrompt -from .agent_params_vector_database import AgentParamsVectorDatabase -from .agent_params_voice import AgentParamsVoice -from .agent_params_voice_one import ( - AgentParamsVoiceOne, - AgentParamsVoiceOne_VoiceAzure, - AgentParamsVoiceOne_VoiceElevenLabs, - AgentParamsVoiceOne_VoicePlayHt, - AgentParamsVoiceOne_VoiceRime, -) -from .agent_params_webhook import AgentParamsWebhook - -__all__ = [ - "AgentParamsActionsItem", - "AgentParamsActionsItemOne", - "AgentParamsActionsItemOne_ActionAddToConference", - "AgentParamsActionsItemOne_ActionDtmf", - "AgentParamsActionsItemOne_ActionEndConversation", - "AgentParamsActionsItemOne_ActionExternal", - "AgentParamsActionsItemOne_ActionSetHold", - "AgentParamsActionsItemOne_ActionTransferCall", - "AgentParamsEndpointingSensitivity", - "AgentParamsIvrNavigationMode", - "AgentParamsOpenaiAccountConnection", - "AgentParamsPrompt", - "AgentParamsVectorDatabase", - "AgentParamsVoice", - "AgentParamsVoiceOne", - "AgentParamsVoiceOne_VoiceAzure", - "AgentParamsVoiceOne_VoiceElevenLabs", - "AgentParamsVoiceOne_VoicePlayHt", - "AgentParamsVoiceOne_VoiceRime", - "AgentParamsWebhook", -] diff --git a/src/vocode/resources/agents/types/agent_params_actions_item_one.py b/src/vocode/resources/agents/types/agent_params_actions_item_one.py deleted file mode 100644 index 7a6264a..0000000 --- a/src/vocode/resources/agents/types/agent_params_actions_item_one.py +++ /dev/null @@ -1,78 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from ....types.add_to_conference_action_params import AddToConferenceActionParams -from ....types.dtmf_action_params import DtmfActionParams -from ....types.end_conversation_action_params import EndConversationActionParams -from ....types.external_action_params import ExternalActionParams -from ....types.set_hold_action_params import SetHoldActionParams -from ....types.transfer_call_action_params import TransferCallActionParams - - -class AgentParamsActionsItemOne_ActionTransferCall(TransferCallActionParams): - type: typing_extensions.Literal["action_transfer_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsActionsItemOne_ActionEndConversation(EndConversationActionParams): - type: typing_extensions.Literal["action_end_conversation"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsActionsItemOne_ActionDtmf(DtmfActionParams): - type: typing_extensions.Literal["action_dtmf"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsActionsItemOne_ActionAddToConference(AddToConferenceActionParams): - type: typing_extensions.Literal["action_add_to_conference"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsActionsItemOne_ActionSetHold(SetHoldActionParams): - type: typing_extensions.Literal["action_set_hold"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsActionsItemOne_ActionExternal(ExternalActionParams): - type: typing_extensions.Literal["action_external"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AgentParamsActionsItemOne = typing.Union[ - AgentParamsActionsItemOne_ActionTransferCall, - AgentParamsActionsItemOne_ActionEndConversation, - AgentParamsActionsItemOne_ActionDtmf, - AgentParamsActionsItemOne_ActionAddToConference, - AgentParamsActionsItemOne_ActionSetHold, - AgentParamsActionsItemOne_ActionExternal, -] diff --git a/src/vocode/resources/agents/types/agent_params_endpointing_sensitivity.py b/src/vocode/resources/agents/types/agent_params_endpointing_sensitivity.py deleted file mode 100644 index cd8b990..0000000 --- a/src/vocode/resources/agents/types/agent_params_endpointing_sensitivity.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class AgentParamsEndpointingSensitivity(str, enum.Enum): - AUTO = "auto" - RELAXED = "relaxed" - SENSITIVE = "sensitive" - - def visit( - self, - auto: typing.Callable[[], T_Result], - relaxed: typing.Callable[[], T_Result], - sensitive: typing.Callable[[], T_Result], - ) -> T_Result: - if self is AgentParamsEndpointingSensitivity.AUTO: - return auto() - if self is AgentParamsEndpointingSensitivity.RELAXED: - return relaxed() - if self is AgentParamsEndpointingSensitivity.SENSITIVE: - return sensitive() diff --git a/src/vocode/resources/agents/types/agent_params_ivr_navigation_mode.py b/src/vocode/resources/agents/types/agent_params_ivr_navigation_mode.py deleted file mode 100644 index 19f59d4..0000000 --- a/src/vocode/resources/agents/types/agent_params_ivr_navigation_mode.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class AgentParamsIvrNavigationMode(str, enum.Enum): - DEFAULT = "default" - OFF = "off" - - def visit(self, default: typing.Callable[[], T_Result], off: typing.Callable[[], T_Result]) -> T_Result: - if self is AgentParamsIvrNavigationMode.DEFAULT: - return default() - if self is AgentParamsIvrNavigationMode.OFF: - return off() diff --git a/src/vocode/resources/agents/types/agent_params_voice_one.py b/src/vocode/resources/agents/types/agent_params_voice_one.py deleted file mode 100644 index 7e8f3ac..0000000 --- a/src/vocode/resources/agents/types/agent_params_voice_one.py +++ /dev/null @@ -1,56 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from ....types.azure_voice_params import AzureVoiceParams -from ....types.eleven_labs_voice_params import ElevenLabsVoiceParams -from ....types.play_ht_voice_params import PlayHtVoiceParams -from ....types.rime_voice_params import RimeVoiceParams - - -class AgentParamsVoiceOne_VoiceAzure(AzureVoiceParams): - type: typing_extensions.Literal["voice_azure"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsVoiceOne_VoiceRime(RimeVoiceParams): - type: typing_extensions.Literal["voice_rime"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsVoiceOne_VoiceElevenLabs(ElevenLabsVoiceParams): - type: typing_extensions.Literal["voice_eleven_labs"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentParamsVoiceOne_VoicePlayHt(PlayHtVoiceParams): - type: typing_extensions.Literal["voice_play_ht"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AgentParamsVoiceOne = typing.Union[ - AgentParamsVoiceOne_VoiceAzure, - AgentParamsVoiceOne_VoiceRime, - AgentParamsVoiceOne_VoiceElevenLabs, - AgentParamsVoiceOne_VoicePlayHt, -] diff --git a/src/vocode/resources/calls/client.py b/src/vocode/resources/calls/client.py deleted file mode 100644 index d543063..0000000 --- a/src/vocode/resources/calls/client.py +++ /dev/null @@ -1,358 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.call import Call -from ...types.call_page import CallPage -from ...types.http_validation_error import HttpValidationError -from .types.create_call_request_agent import CreateCallRequestAgent -from .types.create_call_request_on_no_human_answer import CreateCallRequestOnNoHumanAnswer - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class CallsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def list_calls( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> CallPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(CallPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_call(self, *, id: str) -> Call: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def end_call(self, *, id: str) -> Call: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/end"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_call( - self, - *, - from_number: str, - to_number: str, - agent: CreateCallRequestAgent, - on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer] = OMIT, - run_do_not_call_detection: typing.Optional[bool] = OMIT, - hipaa_compliant: typing.Optional[bool] = OMIT, - context: typing.Optional[typing.Dict[str, str]] = OMIT, - telephony_params: typing.Optional[typing.Dict[str, str]] = OMIT, - ) -> Call: - """ - Parameters: - - from_number: str. - - - to_number: str. - - - agent: CreateCallRequestAgent. - - - on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer]. - - - run_do_not_call_detection: typing.Optional[bool]. - - - hipaa_compliant: typing.Optional[bool]. - - - context: typing.Optional[typing.Dict[str, str]]. - - - telephony_params: typing.Optional[typing.Dict[str, str]]. - """ - _request: typing.Dict[str, typing.Any] = {"from_number": from_number, "to_number": to_number, "agent": agent} - if on_no_human_answer is not OMIT: - _request["on_no_human_answer"] = on_no_human_answer - if run_do_not_call_detection is not OMIT: - _request["run_do_not_call_detection"] = run_do_not_call_detection - if hipaa_compliant is not OMIT: - _request["hipaa_compliant"] = hipaa_compliant - if context is not OMIT: - _request["context"] = context - if telephony_params is not OMIT: - _request["telephony_params"] = telephony_params - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/create"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_recording(self, *, id: str) -> typing.Iterator[bytes]: - """ - Parameters: - - id: str. - """ - with self._client_wrapper.httpx_client.stream( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/recording"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - for _chunk in _response.iter_bytes(): - yield _chunk - return - _response.read() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncCallsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def list_calls( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> CallPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(CallPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_call(self, *, id: str) -> Call: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def end_call(self, *, id: str) -> Call: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/end"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_call( - self, - *, - from_number: str, - to_number: str, - agent: CreateCallRequestAgent, - on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer] = OMIT, - run_do_not_call_detection: typing.Optional[bool] = OMIT, - hipaa_compliant: typing.Optional[bool] = OMIT, - context: typing.Optional[typing.Dict[str, str]] = OMIT, - telephony_params: typing.Optional[typing.Dict[str, str]] = OMIT, - ) -> Call: - """ - Parameters: - - from_number: str. - - - to_number: str. - - - agent: CreateCallRequestAgent. - - - on_no_human_answer: typing.Optional[CreateCallRequestOnNoHumanAnswer]. - - - run_do_not_call_detection: typing.Optional[bool]. - - - hipaa_compliant: typing.Optional[bool]. - - - context: typing.Optional[typing.Dict[str, str]]. - - - telephony_params: typing.Optional[typing.Dict[str, str]]. - """ - _request: typing.Dict[str, typing.Any] = {"from_number": from_number, "to_number": to_number, "agent": agent} - if on_no_human_answer is not OMIT: - _request["on_no_human_answer"] = on_no_human_answer - if run_do_not_call_detection is not OMIT: - _request["run_do_not_call_detection"] = run_do_not_call_detection - if hipaa_compliant is not OMIT: - _request["hipaa_compliant"] = hipaa_compliant - if context is not OMIT: - _request["context"] = context - if telephony_params is not OMIT: - _request["telephony_params"] = telephony_params - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/create"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Call, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_recording(self, *, id: str) -> typing.AsyncIterator[bytes]: - """ - Parameters: - - id: str. - """ - async with self._client_wrapper.httpx_client.stream( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/calls/recording"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - async for _chunk in _response.aiter_bytes(): - yield _chunk - return - await _response.aread() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/calls/types/create_call_request_on_no_human_answer.py b/src/vocode/resources/calls/types/create_call_request_on_no_human_answer.py deleted file mode 100644 index 15accd6..0000000 --- a/src/vocode/resources/calls/types/create_call_request_on_no_human_answer.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class CreateCallRequestOnNoHumanAnswer(str, enum.Enum): - CONTINUE = "continue" - HANGUP = "hangup" - - def visit(self, continue_: typing.Callable[[], T_Result], hangup: typing.Callable[[], T_Result]) -> T_Result: - if self is CreateCallRequestOnNoHumanAnswer.CONTINUE: - return continue_() - if self is CreateCallRequestOnNoHumanAnswer.HANGUP: - return hangup() diff --git a/src/vocode/resources/numbers/client.py b/src/vocode/resources/numbers/client.py deleted file mode 100644 index 27eba5d..0000000 --- a/src/vocode/resources/numbers/client.py +++ /dev/null @@ -1,407 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.buy_phone_number_request import BuyPhoneNumberRequest -from ...types.http_validation_error import HttpValidationError -from ...types.phone_number import PhoneNumber -from ...types.phone_number_page import PhoneNumberPage -from .types.update_number_request_example_context import UpdateNumberRequestExampleContext -from .types.update_number_request_inbound_agent import UpdateNumberRequestInboundAgent -from .types.update_number_request_label import UpdateNumberRequestLabel -from .types.update_number_request_outbound_only import UpdateNumberRequestOutboundOnly - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class NumbersClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def list_numbers( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> PhoneNumberPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumberPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_number(self, *, phone_number: str) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers"), - params=remove_none_from_dict({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def buy_number(self, *, request: BuyPhoneNumberRequest) -> PhoneNumber: - """ - Parameters: - - request: BuyPhoneNumberRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/buy"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_number( - self, - *, - phone_number: str, - outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly] = OMIT, - example_context: typing.Optional[UpdateNumberRequestExampleContext] = OMIT, - label: typing.Optional[UpdateNumberRequestLabel] = OMIT, - inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent] = OMIT, - ) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - - - outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly]. - - - example_context: typing.Optional[UpdateNumberRequestExampleContext]. - - - label: typing.Optional[UpdateNumberRequestLabel]. - - - inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent]. - """ - _request: typing.Dict[str, typing.Any] = {} - if outbound_only is not OMIT: - _request["outbound_only"] = outbound_only - if example_context is not OMIT: - _request["example_context"] = example_context - if label is not OMIT: - _request["label"] = label - if inbound_agent is not OMIT: - _request["inbound_agent"] = inbound_agent - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/update"), - params=remove_none_from_dict({"phone_number": phone_number}), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def cancel_number(self, *, phone_number: str) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/cancel"), - params=remove_none_from_dict({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def link_number( - self, *, phone_number: str, telephony_account_connection: str, outbound_only: typing.Optional[bool] = OMIT - ) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - - - telephony_account_connection: str. - - - outbound_only: typing.Optional[bool]. - """ - _request: typing.Dict[str, typing.Any] = { - "phone_number": phone_number, - "telephony_account_connection": telephony_account_connection, - } - if outbound_only is not OMIT: - _request["outbound_only"] = outbound_only - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/link"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncNumbersClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def list_numbers( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> PhoneNumberPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumberPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_number(self, *, phone_number: str) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers"), - params=remove_none_from_dict({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def buy_number(self, *, request: BuyPhoneNumberRequest) -> PhoneNumber: - """ - Parameters: - - request: BuyPhoneNumberRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/buy"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_number( - self, - *, - phone_number: str, - outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly] = OMIT, - example_context: typing.Optional[UpdateNumberRequestExampleContext] = OMIT, - label: typing.Optional[UpdateNumberRequestLabel] = OMIT, - inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent] = OMIT, - ) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - - - outbound_only: typing.Optional[UpdateNumberRequestOutboundOnly]. - - - example_context: typing.Optional[UpdateNumberRequestExampleContext]. - - - label: typing.Optional[UpdateNumberRequestLabel]. - - - inbound_agent: typing.Optional[UpdateNumberRequestInboundAgent]. - """ - _request: typing.Dict[str, typing.Any] = {} - if outbound_only is not OMIT: - _request["outbound_only"] = outbound_only - if example_context is not OMIT: - _request["example_context"] = example_context - if label is not OMIT: - _request["label"] = label - if inbound_agent is not OMIT: - _request["inbound_agent"] = inbound_agent - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/update"), - params=remove_none_from_dict({"phone_number": phone_number}), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def cancel_number(self, *, phone_number: str) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/cancel"), - params=remove_none_from_dict({"phone_number": phone_number}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def link_number( - self, *, phone_number: str, telephony_account_connection: str, outbound_only: typing.Optional[bool] = OMIT - ) -> PhoneNumber: - """ - Parameters: - - phone_number: str. - - - telephony_account_connection: str. - - - outbound_only: typing.Optional[bool]. - """ - _request: typing.Dict[str, typing.Any] = { - "phone_number": phone_number, - "telephony_account_connection": telephony_account_connection, - } - if outbound_only is not OMIT: - _request["outbound_only"] = outbound_only - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/link"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/numbers/types/update_number_request_inbound_agent.py b/src/vocode/resources/numbers/types/update_number_request_inbound_agent.py deleted file mode 100644 index f8a5e8e..0000000 --- a/src/vocode/resources/numbers/types/update_number_request_inbound_agent.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from ....types.agent_update_params import AgentUpdateParams -from ....types.undefined import Undefined - -UpdateNumberRequestInboundAgent = typing.Union[str, AgentUpdateParams, Undefined] diff --git a/src/vocode/resources/prompts/client.py b/src/vocode/resources/prompts/client.py deleted file mode 100644 index b29d6ed..0000000 --- a/src/vocode/resources/prompts/client.py +++ /dev/null @@ -1,246 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.prompt import Prompt -from ...types.prompt_page import PromptPage -from ...types.prompt_params import PromptParams -from ...types.prompt_update_params import PromptUpdateParams - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class PromptsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_prompt(self, *, id: str) -> Prompt: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_prompts( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> PromptPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PromptPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_prompt(self, *, request: PromptParams) -> Prompt: - """ - Parameters: - - request: PromptParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_prompt(self, *, id: str, request: PromptUpdateParams) -> Prompt: - """ - Parameters: - - id: str. - - - request: PromptUpdateParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncPromptsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_prompt(self, *, id: str) -> Prompt: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_prompts( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> PromptPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PromptPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_prompt(self, *, request: PromptParams) -> Prompt: - """ - Parameters: - - request: PromptParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_prompt(self, *, id: str, request: PromptUpdateParams) -> Prompt: - """ - Parameters: - - id: str. - - - request: PromptUpdateParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/prompts/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Prompt, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/usage/client.py b/src/vocode/resources/usage/client.py deleted file mode 100644 index fbddd57..0000000 --- a/src/vocode/resources/usage/client.py +++ /dev/null @@ -1,53 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...types.usage import Usage - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class UsageClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_usage(self) -> Usage: - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/usage"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Usage, _response.json()) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncUsageClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_usage(self) -> Usage: - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/usage"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Usage, _response.json()) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/vector_databases/client.py b/src/vocode/resources/vector_databases/client.py deleted file mode 100644 index 7aa5716..0000000 --- a/src/vocode/resources/vector_databases/client.py +++ /dev/null @@ -1,248 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.pinecone_vector_database import PineconeVectorDatabase -from ...types.pinecone_vector_database_params import PineconeVectorDatabaseParams -from ...types.pinecone_vector_database_update_params import PineconeVectorDatabaseUpdateParams -from ...types.vector_database_page import VectorDatabasePage - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class VectorDatabasesClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_vector_database(self, *, id: str) -> PineconeVectorDatabase: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_vector_databases( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> VectorDatabasePage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VectorDatabasePage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_vector_database(self, *, request: PineconeVectorDatabaseParams) -> PineconeVectorDatabase: - """ - Parameters: - - request: PineconeVectorDatabaseParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_vector_database(self, *, id: str, request: PineconeVectorDatabaseUpdateParams) -> PineconeVectorDatabase: - """ - Parameters: - - id: str. - - - request: PineconeVectorDatabaseUpdateParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncVectorDatabasesClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_vector_database(self, *, id: str) -> PineconeVectorDatabase: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_vector_databases( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> VectorDatabasePage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VectorDatabasePage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_vector_database(self, *, request: PineconeVectorDatabaseParams) -> PineconeVectorDatabase: - """ - Parameters: - - request: PineconeVectorDatabaseParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_vector_database( - self, *, id: str, request: PineconeVectorDatabaseUpdateParams - ) -> PineconeVectorDatabase: - """ - Parameters: - - id: str. - - - request: PineconeVectorDatabaseUpdateParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/vector_databases/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(PineconeVectorDatabase, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/voices/client.py b/src/vocode/resources/voices/client.py deleted file mode 100644 index 1bf57d4..0000000 --- a/src/vocode/resources/voices/client.py +++ /dev/null @@ -1,246 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.voice_page import VoicePage -from ...types.voice_params_request import VoiceParamsRequest -from ...types.voice_response_model import VoiceResponseModel -from ...types.voice_update_params_request import VoiceUpdateParamsRequest - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class VoicesClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_voice(self, *, id: str) -> VoiceResponseModel: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_voices( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> VoicePage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoicePage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_voice(self, *, request: VoiceParamsRequest) -> VoiceResponseModel: - """ - Parameters: - - request: VoiceParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_voice(self, *, id: str, request: VoiceUpdateParamsRequest) -> VoiceResponseModel: - """ - Parameters: - - id: str. - - - request: VoiceUpdateParamsRequest. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncVoicesClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_voice(self, *, id: str) -> VoiceResponseModel: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_voices( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> VoicePage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoicePage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_voice(self, *, request: VoiceParamsRequest) -> VoiceResponseModel: - """ - Parameters: - - request: VoiceParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_voice(self, *, id: str, request: VoiceUpdateParamsRequest) -> VoiceResponseModel: - """ - Parameters: - - id: str. - - - request: VoiceUpdateParamsRequest. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/webhooks/client.py b/src/vocode/resources/webhooks/client.py deleted file mode 100644 index a2b6818..0000000 --- a/src/vocode/resources/webhooks/client.py +++ /dev/null @@ -1,246 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.webhook import Webhook -from ...types.webhook_page import WebhookPage -from ...types.webhook_params import WebhookParams -from ...types.webhook_update_params import WebhookUpdateParams - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class WebhooksClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_webhook(self, *, id: str) -> Webhook: - """ - Parameters: - - id: str. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def list_webhooks( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> WebhookPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(WebhookPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def create_webhook(self, *, request: WebhookParams) -> Webhook: - """ - Parameters: - - request: WebhookParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_webhook(self, *, id: str, request: WebhookUpdateParams) -> Webhook: - """ - Parameters: - - id: str. - - - request: WebhookUpdateParams. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncWebhooksClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_webhook(self, *, id: str) -> Webhook: - """ - Parameters: - - id: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks"), - params=remove_none_from_dict({"id": id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_webhooks( - self, - *, - page: typing.Optional[int] = None, - size: typing.Optional[int] = None, - sort_column: typing.Optional[str] = None, - sort_desc: typing.Optional[bool] = None, - ) -> WebhookPage: - """ - Parameters: - - page: typing.Optional[int]. - - - size: typing.Optional[int]. - - - sort_column: typing.Optional[str]. - - - sort_desc: typing.Optional[bool]. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/list"), - params=remove_none_from_dict( - {"page": page, "size": size, "sort_column": sort_column, "sort_desc": sort_desc} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(WebhookPage, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def create_webhook(self, *, request: WebhookParams) -> Webhook: - """ - Parameters: - - request: WebhookParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/create"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_webhook(self, *, id: str, request: WebhookUpdateParams) -> Webhook: - """ - Parameters: - - id: str. - - - request: WebhookUpdateParams. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/webhooks/update"), - params=remove_none_from_dict({"id": id}), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Webhook, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/types/__init__.py b/src/vocode/types/__init__.py index bb0c98f..6d878b9 100644 --- a/src/vocode/types/__init__.py +++ b/src/vocode/types/__init__.py @@ -1,118 +1,61 @@ # This file was auto-generated by Fern from our API Definition. from .account_connection_page import AccountConnectionPage -from .account_connection_page_items_item import ( - AccountConnectionPageItemsItem, - AccountConnectionPageItemsItem_AccountConnectionOpenai, - AccountConnectionPageItemsItem_AccountConnectionTwilio, -) -from .account_connection_params_request import ( - AccountConnectionParamsRequest, - AccountConnectionParamsRequest_AccountConnectionOpenai, - AccountConnectionParamsRequest_AccountConnectionTwilio, -) -from .account_connection_response_model import ( - AccountConnectionResponseModel, - AccountConnectionResponseModel_AccountConnectionOpenai, - AccountConnectionResponseModel_AccountConnectionTwilio, -) -from .account_connection_update_params_request import ( - AccountConnectionUpdateParamsRequest, - AccountConnectionUpdateParamsRequest_AccountConnectionOpenai, - AccountConnectionUpdateParamsRequest_AccountConnectionTwilio, -) +from .account_connection_page_items_item import AccountConnectionPageItemsItem +from .account_connection_params_request import AccountConnectionParamsRequest +from .account_connection_response_model import AccountConnectionResponseModel +from .account_connection_update_params_request import AccountConnectionUpdateParamsRequest from .action_page import ActionPage -from .action_page_items_item import ( - ActionPageItemsItem, - ActionPageItemsItem_ActionAddToConference, - ActionPageItemsItem_ActionDtmf, - ActionPageItemsItem_ActionEndConversation, - ActionPageItemsItem_ActionExternal, - ActionPageItemsItem_ActionSetHold, - ActionPageItemsItem_ActionTransferCall, -) -from .action_params_request import ( - ActionParamsRequest, - ActionParamsRequest_ActionAddToConference, - ActionParamsRequest_ActionDtmf, - ActionParamsRequest_ActionEndConversation, - ActionParamsRequest_ActionExternal, - ActionParamsRequest_ActionSetHold, - ActionParamsRequest_ActionTransferCall, -) -from .action_response_model import ( - ActionResponseModel, - ActionResponseModel_ActionAddToConference, - ActionResponseModel_ActionDtmf, - ActionResponseModel_ActionEndConversation, - ActionResponseModel_ActionExternal, - ActionResponseModel_ActionSetHold, - ActionResponseModel_ActionTransferCall, -) -from .action_update_params_request import ( - ActionUpdateParamsRequest, - ActionUpdateParamsRequest_ActionAddToConference, - ActionUpdateParamsRequest_ActionDtmf, - ActionUpdateParamsRequest_ActionEndConversation, - ActionUpdateParamsRequest_ActionExternal, - ActionUpdateParamsRequest_ActionSetHold, - ActionUpdateParamsRequest_ActionTransferCall, -) +from .action_page_items_item import ActionPageItemsItem +from .action_params_request import ActionParamsRequest +from .action_response_model import ActionResponseModel +from .action_update_params_request import ActionUpdateParamsRequest from .add_to_conference_action import AddToConferenceAction -from .add_to_conference_action_action_trigger import ( - AddToConferenceActionActionTrigger, - AddToConferenceActionActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionActionTrigger_ActionTriggerPhraseBased, -) +from .add_to_conference_action_action_trigger import AddToConferenceActionActionTrigger from .add_to_conference_action_params import AddToConferenceActionParams -from .add_to_conference_action_params_action_trigger import ( - AddToConferenceActionParamsActionTrigger, - AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased, -) +from .add_to_conference_action_params_action_trigger import AddToConferenceActionParamsActionTrigger from .add_to_conference_action_update_params import AddToConferenceActionUpdateParams from .add_to_conference_action_update_params_action_trigger import AddToConferenceActionUpdateParamsActionTrigger from .add_to_conference_action_update_params_action_trigger_zero import ( AddToConferenceActionUpdateParamsActionTriggerZero, - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, ) from .add_to_conference_action_update_params_config import AddToConferenceActionUpdateParamsConfig from .add_to_conference_config import AddToConferenceConfig +from .add_to_steering_pool_body import AddToSteeringPoolBody from .agent import Agent -from .agent_actions_item import ( - AgentActionsItem, - AgentActionsItem_ActionAddToConference, - AgentActionsItem_ActionDtmf, - AgentActionsItem_ActionEndConversation, - AgentActionsItem_ActionExternal, - AgentActionsItem_ActionSetHold, - AgentActionsItem_ActionTransferCall, -) +from .agent_actions_item import AgentActionsItem +from .agent_deepgram_keywords_value import AgentDeepgramKeywordsValue from .agent_endpointing_sensitivity import AgentEndpointingSensitivity from .agent_ivr_navigation_mode import AgentIvrNavigationMode from .agent_page import AgentPage +from .agent_params import AgentParams +from .agent_params_actions_item import AgentParamsActionsItem +from .agent_params_actions_item_one import AgentParamsActionsItemOne +from .agent_params_deepgram_keywords_value import AgentParamsDeepgramKeywordsValue +from .agent_params_endpointing_sensitivity import AgentParamsEndpointingSensitivity +from .agent_params_ivr_navigation_mode import AgentParamsIvrNavigationMode +from .agent_params_openai_account_connection import AgentParamsOpenaiAccountConnection +from .agent_params_prompt import AgentParamsPrompt +from .agent_params_vector_database import AgentParamsVectorDatabase +from .agent_params_voice import AgentParamsVoice +from .agent_params_voice_one import AgentParamsVoiceOne +from .agent_params_webhook import AgentParamsWebhook from .agent_update_params import AgentUpdateParams from .agent_update_params_actions import AgentUpdateParamsActions from .agent_update_params_actions_item import AgentUpdateParamsActionsItem -from .agent_update_params_actions_item_one import ( - AgentUpdateParamsActionsItemOne, - AgentUpdateParamsActionsItemOne_ActionAddToConference, - AgentUpdateParamsActionsItemOne_ActionDtmf, - AgentUpdateParamsActionsItemOne_ActionEndConversation, - AgentUpdateParamsActionsItemOne_ActionExternal, - AgentUpdateParamsActionsItemOne_ActionSetHold, - AgentUpdateParamsActionsItemOne_ActionTransferCall, -) +from .agent_update_params_actions_item_one import AgentUpdateParamsActionsItemOne from .agent_update_params_ask_if_human_present_on_idle import AgentUpdateParamsAskIfHumanPresentOnIdle from .agent_update_params_context_endpoint import AgentUpdateParamsContextEndpoint from .agent_update_params_conversation_speed import AgentUpdateParamsConversationSpeed +from .agent_update_params_deepgram_keywords import AgentUpdateParamsDeepgramKeywords +from .agent_update_params_deepgram_keywords_zero_value import AgentUpdateParamsDeepgramKeywordsZeroValue from .agent_update_params_endpointing_sensitivity import AgentUpdateParamsEndpointingSensitivity from .agent_update_params_initial_message import AgentUpdateParamsInitialMessage from .agent_update_params_initial_message_delay import AgentUpdateParamsInitialMessageDelay from .agent_update_params_interrupt_sensitivity import AgentUpdateParamsInterruptSensitivity from .agent_update_params_ivr_navigation_mode import AgentUpdateParamsIvrNavigationMode from .agent_update_params_language import AgentUpdateParamsLanguage +from .agent_update_params_llm_fallback import AgentUpdateParamsLlmFallback from .agent_update_params_name import AgentUpdateParamsName from .agent_update_params_noise_suppression import AgentUpdateParamsNoiseSuppression from .agent_update_params_openai_account_connection import AgentUpdateParamsOpenaiAccountConnection @@ -121,29 +64,15 @@ from .agent_update_params_run_do_not_call_detection import AgentUpdateParamsRunDoNotCallDetection from .agent_update_params_vector_database import AgentUpdateParamsVectorDatabase from .agent_update_params_voice import AgentUpdateParamsVoice -from .agent_update_params_voice_one import ( - AgentUpdateParamsVoiceOne, - AgentUpdateParamsVoiceOne_VoiceAzure, - AgentUpdateParamsVoiceOne_VoiceElevenLabs, - AgentUpdateParamsVoiceOne_VoicePlayHt, - AgentUpdateParamsVoiceOne_VoiceRime, -) +from .agent_update_params_voice_one import AgentUpdateParamsVoiceOne from .agent_update_params_webhook import AgentUpdateParamsWebhook -from .agent_voice import ( - AgentVoice, - AgentVoice_VoiceAzure, - AgentVoice_VoiceElevenLabs, - AgentVoice_VoicePlayHt, - AgentVoice_VoiceRime, -) +from .agent_voice import AgentVoice from .azure_voice import AzureVoice from .azure_voice_params import AzureVoiceParams from .azure_voice_update_params import AzureVoiceUpdateParams from .azure_voice_update_params_pitch import AzureVoiceUpdateParamsPitch from .azure_voice_update_params_rate import AzureVoiceUpdateParamsRate from .azure_voice_update_params_voice_name import AzureVoiceUpdateParamsVoiceName -from .buy_phone_number_request import BuyPhoneNumberRequest -from .buy_phone_number_request_telephony_provider import BuyPhoneNumberRequestTelephonyProvider from .call import Call from .call_human_detection_result import CallHumanDetectionResult from .call_on_no_human_answer import CallOnNoHumanAnswer @@ -151,57 +80,25 @@ from .call_stage import CallStage from .call_stage_outcome import CallStageOutcome from .call_status import CallStatus -from .call_telephony_metadata import ( - CallTelephonyMetadata, - CallTelephonyMetadata_TelephonyMetadataTwilio, - CallTelephonyMetadata_TelephonyMetadataVonage, -) +from .call_telephony_metadata import CallTelephonyMetadata from .call_telephony_provider import CallTelephonyProvider from .collect_field import CollectField from .create_call_agent_params import CreateCallAgentParams from .create_call_agent_params_actions_item import CreateCallAgentParamsActionsItem -from .create_call_agent_params_actions_item_one import ( - CreateCallAgentParamsActionsItemOne, - CreateCallAgentParamsActionsItemOne_ActionAddToConference, - CreateCallAgentParamsActionsItemOne_ActionDtmf, - CreateCallAgentParamsActionsItemOne_ActionEndConversation, - CreateCallAgentParamsActionsItemOne_ActionExternal, - CreateCallAgentParamsActionsItemOne_ActionSetHold, - CreateCallAgentParamsActionsItemOne_ActionTransferCall, -) +from .create_call_agent_params_actions_item_one import CreateCallAgentParamsActionsItemOne +from .create_call_agent_params_deepgram_keywords_value import CreateCallAgentParamsDeepgramKeywordsValue from .create_call_agent_params_endpointing_sensitivity import CreateCallAgentParamsEndpointingSensitivity from .create_call_agent_params_ivr_navigation_mode import CreateCallAgentParamsIvrNavigationMode from .create_call_agent_params_openai_account_connection import CreateCallAgentParamsOpenaiAccountConnection from .create_call_agent_params_prompt import CreateCallAgentParamsPrompt from .create_call_agent_params_vector_database import CreateCallAgentParamsVectorDatabase from .create_call_agent_params_voice import CreateCallAgentParamsVoice -from .create_call_agent_params_voice_one import ( - CreateCallAgentParamsVoiceOne, - CreateCallAgentParamsVoiceOne_VoiceAzure, - CreateCallAgentParamsVoiceOne_VoiceElevenLabs, - CreateCallAgentParamsVoiceOne_VoicePlayHt, - CreateCallAgentParamsVoiceOne_VoiceRime, -) +from .create_call_agent_params_voice_one import CreateCallAgentParamsVoiceOne from .create_call_agent_params_webhook import CreateCallAgentParamsWebhook from .dtmf_action import DtmfAction -from .dtmf_action_action_trigger import ( - DtmfActionActionTrigger, - DtmfActionActionTrigger_ActionTriggerFunctionCall, - DtmfActionActionTrigger_ActionTriggerPhraseBased, -) from .dtmf_action_params import DtmfActionParams -from .dtmf_action_params_action_trigger import ( - DtmfActionParamsActionTrigger, - DtmfActionParamsActionTrigger_ActionTriggerFunctionCall, - DtmfActionParamsActionTrigger_ActionTriggerPhraseBased, -) from .dtmf_action_update_params import DtmfActionUpdateParams from .dtmf_action_update_params_action_trigger import DtmfActionUpdateParamsActionTrigger -from .dtmf_action_update_params_action_trigger_zero import ( - DtmfActionUpdateParamsActionTriggerZero, - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -) from .dtmf_action_update_params_config import DtmfActionUpdateParamsConfig from .eleven_labs_voice import ElevenLabsVoice from .eleven_labs_voice_params import ElevenLabsVoiceParams @@ -219,54 +116,32 @@ from .eleven_labs_voice_update_params_voice_id import ElevenLabsVoiceUpdateParamsVoiceId from .empty_action_config import EmptyActionConfig from .end_conversation_action import EndConversationAction -from .end_conversation_action_action_trigger import ( - EndConversationActionActionTrigger, - EndConversationActionActionTrigger_ActionTriggerFunctionCall, - EndConversationActionActionTrigger_ActionTriggerPhraseBased, -) +from .end_conversation_action_action_trigger import EndConversationActionActionTrigger from .end_conversation_action_params import EndConversationActionParams -from .end_conversation_action_params_action_trigger import ( - EndConversationActionParamsActionTrigger, - EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall, - EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased, -) +from .end_conversation_action_params_action_trigger import EndConversationActionParamsActionTrigger from .end_conversation_action_update_params import EndConversationActionUpdateParams from .end_conversation_action_update_params_action_trigger import EndConversationActionUpdateParamsActionTrigger from .end_conversation_action_update_params_action_trigger_zero import ( EndConversationActionUpdateParamsActionTriggerZero, - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, ) from .end_conversation_action_update_params_config import EndConversationActionUpdateParamsConfig from .event_type import EventType from .external_action import ExternalAction -from .external_action_action_trigger import ( - ExternalActionActionTrigger, - ExternalActionActionTrigger_ActionTriggerFunctionCall, - ExternalActionActionTrigger_ActionTriggerPhraseBased, -) from .external_action_config import ExternalActionConfig from .external_action_params import ExternalActionParams -from .external_action_params_action_trigger import ( - ExternalActionParamsActionTrigger, - ExternalActionParamsActionTrigger_ActionTriggerFunctionCall, - ExternalActionParamsActionTrigger_ActionTriggerPhraseBased, -) from .external_action_update_params import ExternalActionUpdateParams from .external_action_update_params_action_trigger import ExternalActionUpdateParamsActionTrigger -from .external_action_update_params_action_trigger_zero import ( - ExternalActionUpdateParamsActionTriggerZero, - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -) from .external_action_update_params_config import ExternalActionUpdateParamsConfig from .function_call_action_trigger import FunctionCallActionTrigger from .function_call_action_trigger_config import FunctionCallActionTriggerConfig from .http_method import HttpMethod from .http_validation_error import HttpValidationError +from .internal_llm_fallback import InternalLlmFallback +from .internal_llm_fallback_provider import InternalLlmFallbackProvider from .interrupt_sensitivity import InterruptSensitivity from .language import Language from .normalized_agent import NormalizedAgent +from .normalized_agent_deepgram_keywords_value import NormalizedAgentDeepgramKeywordsValue from .normalized_agent_endpointing_sensitivity import NormalizedAgentEndpointingSensitivity from .normalized_agent_ivr_navigation_mode import NormalizedAgentIvrNavigationMode from .normalized_agent_openai_account_connection import NormalizedAgentOpenaiAccountConnection @@ -278,11 +153,7 @@ from .normalized_call_stage import NormalizedCallStage from .normalized_call_stage_outcome import NormalizedCallStageOutcome from .normalized_call_telephony_account_connection import NormalizedCallTelephonyAccountConnection -from .normalized_call_telephony_metadata import ( - NormalizedCallTelephonyMetadata, - NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio, - NormalizedCallTelephonyMetadata_TelephonyMetadataVonage, -) +from .normalized_call_telephony_metadata import NormalizedCallTelephonyMetadata from .normalized_call_telephony_provider import NormalizedCallTelephonyProvider from .normalized_phone_number import NormalizedPhoneNumber from .normalized_phone_number_telephony_account_connection import NormalizedPhoneNumberTelephonyAccountConnection @@ -296,8 +167,9 @@ from .phone_number import PhoneNumber from .phone_number_page import PhoneNumberPage from .phone_number_telephony_provider import PhoneNumberTelephonyProvider -from .phrase_based_action_trigger import PhraseBasedActionTrigger from .phrase_based_action_trigger_config import PhraseBasedActionTriggerConfig +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput +from .phrase_based_action_trigger_output import PhraseBasedActionTriggerOutput from .phrase_trigger import PhraseTrigger from .pinecone_vector_database import PineconeVectorDatabase from .pinecone_vector_database_params import PineconeVectorDatabaseParams @@ -343,44 +215,20 @@ from .rime_voice_update_params_speaker import RimeVoiceUpdateParamsSpeaker from .rime_voice_update_params_speed_alpha import RimeVoiceUpdateParamsSpeedAlpha from .set_hold_action import SetHoldAction -from .set_hold_action_action_trigger import ( - SetHoldActionActionTrigger, - SetHoldActionActionTrigger_ActionTriggerFunctionCall, - SetHoldActionActionTrigger_ActionTriggerPhraseBased, -) +from .set_hold_action_action_trigger import SetHoldActionActionTrigger from .set_hold_action_params import SetHoldActionParams -from .set_hold_action_params_action_trigger import ( - SetHoldActionParamsActionTrigger, - SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall, - SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased, -) +from .set_hold_action_params_action_trigger import SetHoldActionParamsActionTrigger from .set_hold_action_update_params import SetHoldActionUpdateParams from .set_hold_action_update_params_action_trigger import SetHoldActionUpdateParamsActionTrigger -from .set_hold_action_update_params_action_trigger_zero import ( - SetHoldActionUpdateParamsActionTriggerZero, - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -) +from .set_hold_action_update_params_action_trigger_zero import SetHoldActionUpdateParamsActionTriggerZero from .set_hold_action_update_params_config import SetHoldActionUpdateParamsConfig from .transfer_call_action import TransferCallAction -from .transfer_call_action_action_trigger import ( - TransferCallActionActionTrigger, - TransferCallActionActionTrigger_ActionTriggerFunctionCall, - TransferCallActionActionTrigger_ActionTriggerPhraseBased, -) +from .transfer_call_action_action_trigger import TransferCallActionActionTrigger from .transfer_call_action_params import TransferCallActionParams -from .transfer_call_action_params_action_trigger import ( - TransferCallActionParamsActionTrigger, - TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall, - TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased, -) +from .transfer_call_action_params_action_trigger import TransferCallActionParamsActionTrigger from .transfer_call_action_update_params import TransferCallActionUpdateParams from .transfer_call_action_update_params_action_trigger import TransferCallActionUpdateParamsActionTrigger -from .transfer_call_action_update_params_action_trigger_zero import ( - TransferCallActionUpdateParamsActionTriggerZero, - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -) +from .transfer_call_action_update_params_action_trigger_zero import TransferCallActionUpdateParamsActionTriggerZero from .transfer_call_action_update_params_config import TransferCallActionUpdateParamsConfig from .transfer_call_config import TransferCallConfig from .twilio_account_connection import TwilioAccountConnection @@ -394,35 +242,15 @@ from .validation_error import ValidationError from .validation_error_loc_item import ValidationErrorLocItem from .vector_database_page import VectorDatabasePage +from .vocode_voice import VocodeVoice +from .vocode_voice_params import VocodeVoiceParams +from .vocode_voice_update_params import VocodeVoiceUpdateParams +from .vocode_voice_update_params_voice_id import VocodeVoiceUpdateParamsVoiceId from .voice_page import VoicePage -from .voice_page_items_item import ( - VoicePageItemsItem, - VoicePageItemsItem_VoiceAzure, - VoicePageItemsItem_VoiceElevenLabs, - VoicePageItemsItem_VoicePlayHt, - VoicePageItemsItem_VoiceRime, -) -from .voice_params_request import ( - VoiceParamsRequest, - VoiceParamsRequest_VoiceAzure, - VoiceParamsRequest_VoiceElevenLabs, - VoiceParamsRequest_VoicePlayHt, - VoiceParamsRequest_VoiceRime, -) -from .voice_response_model import ( - VoiceResponseModel, - VoiceResponseModel_VoiceAzure, - VoiceResponseModel_VoiceElevenLabs, - VoiceResponseModel_VoicePlayHt, - VoiceResponseModel_VoiceRime, -) -from .voice_update_params_request import ( - VoiceUpdateParamsRequest, - VoiceUpdateParamsRequest_VoiceAzure, - VoiceUpdateParamsRequest_VoiceElevenLabs, - VoiceUpdateParamsRequest_VoicePlayHt, - VoiceUpdateParamsRequest_VoiceRime, -) +from .voice_page_items_item import VoicePageItemsItem +from .voice_params_request import VoiceParamsRequest +from .voice_response_model import VoiceResponseModel +from .voice_update_params_request import VoiceUpdateParamsRequest from .vonage_telephony_metadata import VonageTelephonyMetadata from .webhook import Webhook from .webhook_page import WebhookPage @@ -435,91 +263,58 @@ __all__ = [ "AccountConnectionPage", "AccountConnectionPageItemsItem", - "AccountConnectionPageItemsItem_AccountConnectionOpenai", - "AccountConnectionPageItemsItem_AccountConnectionTwilio", "AccountConnectionParamsRequest", - "AccountConnectionParamsRequest_AccountConnectionOpenai", - "AccountConnectionParamsRequest_AccountConnectionTwilio", "AccountConnectionResponseModel", - "AccountConnectionResponseModel_AccountConnectionOpenai", - "AccountConnectionResponseModel_AccountConnectionTwilio", "AccountConnectionUpdateParamsRequest", - "AccountConnectionUpdateParamsRequest_AccountConnectionOpenai", - "AccountConnectionUpdateParamsRequest_AccountConnectionTwilio", "ActionPage", "ActionPageItemsItem", - "ActionPageItemsItem_ActionAddToConference", - "ActionPageItemsItem_ActionDtmf", - "ActionPageItemsItem_ActionEndConversation", - "ActionPageItemsItem_ActionExternal", - "ActionPageItemsItem_ActionSetHold", - "ActionPageItemsItem_ActionTransferCall", "ActionParamsRequest", - "ActionParamsRequest_ActionAddToConference", - "ActionParamsRequest_ActionDtmf", - "ActionParamsRequest_ActionEndConversation", - "ActionParamsRequest_ActionExternal", - "ActionParamsRequest_ActionSetHold", - "ActionParamsRequest_ActionTransferCall", "ActionResponseModel", - "ActionResponseModel_ActionAddToConference", - "ActionResponseModel_ActionDtmf", - "ActionResponseModel_ActionEndConversation", - "ActionResponseModel_ActionExternal", - "ActionResponseModel_ActionSetHold", - "ActionResponseModel_ActionTransferCall", "ActionUpdateParamsRequest", - "ActionUpdateParamsRequest_ActionAddToConference", - "ActionUpdateParamsRequest_ActionDtmf", - "ActionUpdateParamsRequest_ActionEndConversation", - "ActionUpdateParamsRequest_ActionExternal", - "ActionUpdateParamsRequest_ActionSetHold", - "ActionUpdateParamsRequest_ActionTransferCall", "AddToConferenceAction", "AddToConferenceActionActionTrigger", - "AddToConferenceActionActionTrigger_ActionTriggerFunctionCall", - "AddToConferenceActionActionTrigger_ActionTriggerPhraseBased", "AddToConferenceActionParams", "AddToConferenceActionParamsActionTrigger", - "AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall", - "AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased", "AddToConferenceActionUpdateParams", "AddToConferenceActionUpdateParamsActionTrigger", "AddToConferenceActionUpdateParamsActionTriggerZero", - "AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "AddToConferenceActionUpdateParamsConfig", "AddToConferenceConfig", + "AddToSteeringPoolBody", "Agent", "AgentActionsItem", - "AgentActionsItem_ActionAddToConference", - "AgentActionsItem_ActionDtmf", - "AgentActionsItem_ActionEndConversation", - "AgentActionsItem_ActionExternal", - "AgentActionsItem_ActionSetHold", - "AgentActionsItem_ActionTransferCall", + "AgentDeepgramKeywordsValue", "AgentEndpointingSensitivity", "AgentIvrNavigationMode", "AgentPage", + "AgentParams", + "AgentParamsActionsItem", + "AgentParamsActionsItemOne", + "AgentParamsDeepgramKeywordsValue", + "AgentParamsEndpointingSensitivity", + "AgentParamsIvrNavigationMode", + "AgentParamsOpenaiAccountConnection", + "AgentParamsPrompt", + "AgentParamsVectorDatabase", + "AgentParamsVoice", + "AgentParamsVoiceOne", + "AgentParamsWebhook", "AgentUpdateParams", "AgentUpdateParamsActions", "AgentUpdateParamsActionsItem", "AgentUpdateParamsActionsItemOne", - "AgentUpdateParamsActionsItemOne_ActionAddToConference", - "AgentUpdateParamsActionsItemOne_ActionDtmf", - "AgentUpdateParamsActionsItemOne_ActionEndConversation", - "AgentUpdateParamsActionsItemOne_ActionExternal", - "AgentUpdateParamsActionsItemOne_ActionSetHold", - "AgentUpdateParamsActionsItemOne_ActionTransferCall", "AgentUpdateParamsAskIfHumanPresentOnIdle", "AgentUpdateParamsContextEndpoint", "AgentUpdateParamsConversationSpeed", + "AgentUpdateParamsDeepgramKeywords", + "AgentUpdateParamsDeepgramKeywordsZeroValue", "AgentUpdateParamsEndpointingSensitivity", "AgentUpdateParamsInitialMessage", "AgentUpdateParamsInitialMessageDelay", "AgentUpdateParamsInterruptSensitivity", "AgentUpdateParamsIvrNavigationMode", "AgentUpdateParamsLanguage", + "AgentUpdateParamsLlmFallback", "AgentUpdateParamsName", "AgentUpdateParamsNoiseSuppression", "AgentUpdateParamsOpenaiAccountConnection", @@ -529,24 +324,14 @@ "AgentUpdateParamsVectorDatabase", "AgentUpdateParamsVoice", "AgentUpdateParamsVoiceOne", - "AgentUpdateParamsVoiceOne_VoiceAzure", - "AgentUpdateParamsVoiceOne_VoiceElevenLabs", - "AgentUpdateParamsVoiceOne_VoicePlayHt", - "AgentUpdateParamsVoiceOne_VoiceRime", "AgentUpdateParamsWebhook", "AgentVoice", - "AgentVoice_VoiceAzure", - "AgentVoice_VoiceElevenLabs", - "AgentVoice_VoicePlayHt", - "AgentVoice_VoiceRime", "AzureVoice", "AzureVoiceParams", "AzureVoiceUpdateParams", "AzureVoiceUpdateParamsPitch", "AzureVoiceUpdateParamsRate", "AzureVoiceUpdateParamsVoiceName", - "BuyPhoneNumberRequest", - "BuyPhoneNumberRequestTelephonyProvider", "Call", "CallHumanDetectionResult", "CallOnNoHumanAnswer", @@ -555,19 +340,12 @@ "CallStageOutcome", "CallStatus", "CallTelephonyMetadata", - "CallTelephonyMetadata_TelephonyMetadataTwilio", - "CallTelephonyMetadata_TelephonyMetadataVonage", "CallTelephonyProvider", "CollectField", "CreateCallAgentParams", "CreateCallAgentParamsActionsItem", "CreateCallAgentParamsActionsItemOne", - "CreateCallAgentParamsActionsItemOne_ActionAddToConference", - "CreateCallAgentParamsActionsItemOne_ActionDtmf", - "CreateCallAgentParamsActionsItemOne_ActionEndConversation", - "CreateCallAgentParamsActionsItemOne_ActionExternal", - "CreateCallAgentParamsActionsItemOne_ActionSetHold", - "CreateCallAgentParamsActionsItemOne_ActionTransferCall", + "CreateCallAgentParamsDeepgramKeywordsValue", "CreateCallAgentParamsEndpointingSensitivity", "CreateCallAgentParamsIvrNavigationMode", "CreateCallAgentParamsOpenaiAccountConnection", @@ -575,24 +353,11 @@ "CreateCallAgentParamsVectorDatabase", "CreateCallAgentParamsVoice", "CreateCallAgentParamsVoiceOne", - "CreateCallAgentParamsVoiceOne_VoiceAzure", - "CreateCallAgentParamsVoiceOne_VoiceElevenLabs", - "CreateCallAgentParamsVoiceOne_VoicePlayHt", - "CreateCallAgentParamsVoiceOne_VoiceRime", "CreateCallAgentParamsWebhook", "DtmfAction", - "DtmfActionActionTrigger", - "DtmfActionActionTrigger_ActionTriggerFunctionCall", - "DtmfActionActionTrigger_ActionTriggerPhraseBased", "DtmfActionParams", - "DtmfActionParamsActionTrigger", - "DtmfActionParamsActionTrigger_ActionTriggerFunctionCall", - "DtmfActionParamsActionTrigger_ActionTriggerPhraseBased", "DtmfActionUpdateParams", "DtmfActionUpdateParamsActionTrigger", - "DtmfActionUpdateParamsActionTriggerZero", - "DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "DtmfActionUpdateParamsConfig", "ElevenLabsVoice", "ElevenLabsVoiceParams", @@ -607,41 +372,29 @@ "EmptyActionConfig", "EndConversationAction", "EndConversationActionActionTrigger", - "EndConversationActionActionTrigger_ActionTriggerFunctionCall", - "EndConversationActionActionTrigger_ActionTriggerPhraseBased", "EndConversationActionParams", "EndConversationActionParamsActionTrigger", - "EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall", - "EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased", "EndConversationActionUpdateParams", "EndConversationActionUpdateParamsActionTrigger", "EndConversationActionUpdateParamsActionTriggerZero", - "EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "EndConversationActionUpdateParamsConfig", "EventType", "ExternalAction", - "ExternalActionActionTrigger", - "ExternalActionActionTrigger_ActionTriggerFunctionCall", - "ExternalActionActionTrigger_ActionTriggerPhraseBased", "ExternalActionConfig", "ExternalActionParams", - "ExternalActionParamsActionTrigger", - "ExternalActionParamsActionTrigger_ActionTriggerFunctionCall", - "ExternalActionParamsActionTrigger_ActionTriggerPhraseBased", "ExternalActionUpdateParams", "ExternalActionUpdateParamsActionTrigger", - "ExternalActionUpdateParamsActionTriggerZero", - "ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "ExternalActionUpdateParamsConfig", "FunctionCallActionTrigger", "FunctionCallActionTriggerConfig", "HttpMethod", "HttpValidationError", + "InternalLlmFallback", + "InternalLlmFallbackProvider", "InterruptSensitivity", "Language", "NormalizedAgent", + "NormalizedAgentDeepgramKeywordsValue", "NormalizedAgentEndpointingSensitivity", "NormalizedAgentIvrNavigationMode", "NormalizedAgentOpenaiAccountConnection", @@ -654,8 +407,6 @@ "NormalizedCallStageOutcome", "NormalizedCallTelephonyAccountConnection", "NormalizedCallTelephonyMetadata", - "NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio", - "NormalizedCallTelephonyMetadata_TelephonyMetadataVonage", "NormalizedCallTelephonyProvider", "NormalizedPhoneNumber", "NormalizedPhoneNumberTelephonyAccountConnection", @@ -669,8 +420,9 @@ "PhoneNumber", "PhoneNumberPage", "PhoneNumberTelephonyProvider", - "PhraseBasedActionTrigger", "PhraseBasedActionTriggerConfig", + "PhraseBasedActionTriggerInput", + "PhraseBasedActionTriggerOutput", "PhraseTrigger", "PineconeVectorDatabase", "PineconeVectorDatabaseParams", @@ -717,31 +469,19 @@ "RimeVoiceUpdateParamsSpeedAlpha", "SetHoldAction", "SetHoldActionActionTrigger", - "SetHoldActionActionTrigger_ActionTriggerFunctionCall", - "SetHoldActionActionTrigger_ActionTriggerPhraseBased", "SetHoldActionParams", "SetHoldActionParamsActionTrigger", - "SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall", - "SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased", "SetHoldActionUpdateParams", "SetHoldActionUpdateParamsActionTrigger", "SetHoldActionUpdateParamsActionTriggerZero", - "SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "SetHoldActionUpdateParamsConfig", "TransferCallAction", "TransferCallActionActionTrigger", - "TransferCallActionActionTrigger_ActionTriggerFunctionCall", - "TransferCallActionActionTrigger_ActionTriggerPhraseBased", "TransferCallActionParams", "TransferCallActionParamsActionTrigger", - "TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall", - "TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased", "TransferCallActionUpdateParams", "TransferCallActionUpdateParamsActionTrigger", "TransferCallActionUpdateParamsActionTriggerZero", - "TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall", - "TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased", "TransferCallActionUpdateParamsConfig", "TransferCallConfig", "TwilioAccountConnection", @@ -755,27 +495,15 @@ "ValidationError", "ValidationErrorLocItem", "VectorDatabasePage", + "VocodeVoice", + "VocodeVoiceParams", + "VocodeVoiceUpdateParams", + "VocodeVoiceUpdateParamsVoiceId", "VoicePage", "VoicePageItemsItem", - "VoicePageItemsItem_VoiceAzure", - "VoicePageItemsItem_VoiceElevenLabs", - "VoicePageItemsItem_VoicePlayHt", - "VoicePageItemsItem_VoiceRime", "VoiceParamsRequest", - "VoiceParamsRequest_VoiceAzure", - "VoiceParamsRequest_VoiceElevenLabs", - "VoiceParamsRequest_VoicePlayHt", - "VoiceParamsRequest_VoiceRime", "VoiceResponseModel", - "VoiceResponseModel_VoiceAzure", - "VoiceResponseModel_VoiceElevenLabs", - "VoiceResponseModel_VoicePlayHt", - "VoiceResponseModel_VoiceRime", "VoiceUpdateParamsRequest", - "VoiceUpdateParamsRequest_VoiceAzure", - "VoiceUpdateParamsRequest_VoiceElevenLabs", - "VoiceUpdateParamsRequest_VoicePlayHt", - "VoiceUpdateParamsRequest_VoiceRime", "VonageTelephonyMetadata", "Webhook", "WebhookPage", diff --git a/src/vocode/types/account_connection_page.py b/src/vocode/types/account_connection_page.py index b972b29..83471e0 100644 --- a/src/vocode/types/account_connection_page.py +++ b/src/vocode/types/account_connection_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .account_connection_page_items_item import AccountConnectionPageItemsItem - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class AccountConnectionPage(pydantic.BaseModel): +class AccountConnectionPage(UniversalBaseModel): items: typing.List[AccountConnectionPageItemsItem] page: int size: int @@ -20,15 +15,11 @@ class AccountConnectionPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/account_connection_page_items_item.py b/src/vocode/types/account_connection_page_items_item.py index 24b2684..0ac7370 100644 --- a/src/vocode/types/account_connection_page_items_item.py +++ b/src/vocode/types/account_connection_page_items_item.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .open_ai_account_connection import OpenAiAccountConnection from .twilio_account_connection import TwilioAccountConnection - -class AccountConnectionPageItemsItem_AccountConnectionTwilio(TwilioAccountConnection): - type: typing_extensions.Literal["account_connection_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AccountConnectionPageItemsItem_AccountConnectionOpenai(OpenAiAccountConnection): - type: typing_extensions.Literal["account_connection_openai"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AccountConnectionPageItemsItem = typing.Union[ - AccountConnectionPageItemsItem_AccountConnectionTwilio, AccountConnectionPageItemsItem_AccountConnectionOpenai -] +AccountConnectionPageItemsItem = typing.Union[OpenAiAccountConnection, TwilioAccountConnection] diff --git a/src/vocode/types/account_connection_params_request.py b/src/vocode/types/account_connection_params_request.py index e5e5573..e5c3b0e 100644 --- a/src/vocode/types/account_connection_params_request.py +++ b/src/vocode/types/account_connection_params_request.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .open_ai_account_connection_params import OpenAiAccountConnectionParams from .twilio_account_connection_params import TwilioAccountConnectionParams - -class AccountConnectionParamsRequest_AccountConnectionTwilio(TwilioAccountConnectionParams): - type: typing_extensions.Literal["account_connection_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AccountConnectionParamsRequest_AccountConnectionOpenai(OpenAiAccountConnectionParams): - type: typing_extensions.Literal["account_connection_openai"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AccountConnectionParamsRequest = typing.Union[ - AccountConnectionParamsRequest_AccountConnectionTwilio, AccountConnectionParamsRequest_AccountConnectionOpenai -] +AccountConnectionParamsRequest = typing.Union[OpenAiAccountConnectionParams, TwilioAccountConnectionParams] diff --git a/src/vocode/types/account_connection_response_model.py b/src/vocode/types/account_connection_response_model.py index b69844f..4dc2b3b 100644 --- a/src/vocode/types/account_connection_response_model.py +++ b/src/vocode/types/account_connection_response_model.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .open_ai_account_connection import OpenAiAccountConnection from .twilio_account_connection import TwilioAccountConnection - -class AccountConnectionResponseModel_AccountConnectionTwilio(TwilioAccountConnection): - type: typing_extensions.Literal["account_connection_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AccountConnectionResponseModel_AccountConnectionOpenai(OpenAiAccountConnection): - type: typing_extensions.Literal["account_connection_openai"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AccountConnectionResponseModel = typing.Union[ - AccountConnectionResponseModel_AccountConnectionTwilio, AccountConnectionResponseModel_AccountConnectionOpenai -] +AccountConnectionResponseModel = typing.Union[OpenAiAccountConnection, TwilioAccountConnection] diff --git a/src/vocode/types/account_connection_update_params_request.py b/src/vocode/types/account_connection_update_params_request.py index f2d66ef..2a00a34 100644 --- a/src/vocode/types/account_connection_update_params_request.py +++ b/src/vocode/types/account_connection_update_params_request.py @@ -1,34 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .open_ai_account_connection_update_params import OpenAiAccountConnectionUpdateParams from .twilio_account_connection_update_params import TwilioAccountConnectionUpdateParams - -class AccountConnectionUpdateParamsRequest_AccountConnectionTwilio(TwilioAccountConnectionUpdateParams): - type: typing_extensions.Literal["account_connection_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AccountConnectionUpdateParamsRequest_AccountConnectionOpenai(OpenAiAccountConnectionUpdateParams): - type: typing_extensions.Literal["account_connection_openai"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - AccountConnectionUpdateParamsRequest = typing.Union[ - AccountConnectionUpdateParamsRequest_AccountConnectionTwilio, - AccountConnectionUpdateParamsRequest_AccountConnectionOpenai, + OpenAiAccountConnectionUpdateParams, TwilioAccountConnectionUpdateParams ] diff --git a/src/vocode/types/action_page.py b/src/vocode/types/action_page.py index 7100ee8..82c554f 100644 --- a/src/vocode/types/action_page.py +++ b/src/vocode/types/action_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .action_page_items_item import ActionPageItemsItem - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class ActionPage(pydantic.BaseModel): +class ActionPage(UniversalBaseModel): items: typing.List[ActionPageItemsItem] page: int size: int @@ -20,15 +15,11 @@ class ActionPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/action_page_items_item.py b/src/vocode/types/action_page_items_item.py index 0fe75b8..e64b8ac 100644 --- a/src/vocode/types/action_page_items_item.py +++ b/src/vocode/types/action_page_items_item.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .add_to_conference_action import AddToConferenceAction from .dtmf_action import DtmfAction from .end_conversation_action import EndConversationAction @@ -13,66 +8,6 @@ from .set_hold_action import SetHoldAction from .transfer_call_action import TransferCallAction - -class ActionPageItemsItem_ActionTransferCall(TransferCallAction): - type: typing_extensions.Literal["action_transfer_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionPageItemsItem_ActionEndConversation(EndConversationAction): - type: typing_extensions.Literal["action_end_conversation"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionPageItemsItem_ActionDtmf(DtmfAction): - type: typing_extensions.Literal["action_dtmf"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionPageItemsItem_ActionAddToConference(AddToConferenceAction): - type: typing_extensions.Literal["action_add_to_conference"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionPageItemsItem_ActionSetHold(SetHoldAction): - type: typing_extensions.Literal["action_set_hold"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionPageItemsItem_ActionExternal(ExternalAction): - type: typing_extensions.Literal["action_external"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - ActionPageItemsItem = typing.Union[ - ActionPageItemsItem_ActionTransferCall, - ActionPageItemsItem_ActionEndConversation, - ActionPageItemsItem_ActionDtmf, - ActionPageItemsItem_ActionAddToConference, - ActionPageItemsItem_ActionSetHold, - ActionPageItemsItem_ActionExternal, + AddToConferenceAction, DtmfAction, EndConversationAction, ExternalAction, SetHoldAction, TransferCallAction ] diff --git a/src/vocode/types/action_response_model.py b/src/vocode/types/action_response_model.py index 2c6a7ff..100fe29 100644 --- a/src/vocode/types/action_response_model.py +++ b/src/vocode/types/action_response_model.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .add_to_conference_action import AddToConferenceAction from .dtmf_action import DtmfAction from .end_conversation_action import EndConversationAction @@ -13,66 +8,6 @@ from .set_hold_action import SetHoldAction from .transfer_call_action import TransferCallAction - -class ActionResponseModel_ActionTransferCall(TransferCallAction): - type: typing_extensions.Literal["action_transfer_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionResponseModel_ActionEndConversation(EndConversationAction): - type: typing_extensions.Literal["action_end_conversation"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionResponseModel_ActionDtmf(DtmfAction): - type: typing_extensions.Literal["action_dtmf"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionResponseModel_ActionAddToConference(AddToConferenceAction): - type: typing_extensions.Literal["action_add_to_conference"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionResponseModel_ActionSetHold(SetHoldAction): - type: typing_extensions.Literal["action_set_hold"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionResponseModel_ActionExternal(ExternalAction): - type: typing_extensions.Literal["action_external"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - ActionResponseModel = typing.Union[ - ActionResponseModel_ActionTransferCall, - ActionResponseModel_ActionEndConversation, - ActionResponseModel_ActionDtmf, - ActionResponseModel_ActionAddToConference, - ActionResponseModel_ActionSetHold, - ActionResponseModel_ActionExternal, + AddToConferenceAction, DtmfAction, EndConversationAction, ExternalAction, SetHoldAction, TransferCallAction ] diff --git a/src/vocode/types/action_update_params_request.py b/src/vocode/types/action_update_params_request.py index f3ad202..f6fab4a 100644 --- a/src/vocode/types/action_update_params_request.py +++ b/src/vocode/types/action_update_params_request.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .add_to_conference_action_update_params import AddToConferenceActionUpdateParams from .dtmf_action_update_params import DtmfActionUpdateParams from .end_conversation_action_update_params import EndConversationActionUpdateParams @@ -13,66 +8,11 @@ from .set_hold_action_update_params import SetHoldActionUpdateParams from .transfer_call_action_update_params import TransferCallActionUpdateParams - -class ActionUpdateParamsRequest_ActionTransferCall(TransferCallActionUpdateParams): - type: typing_extensions.Literal["action_transfer_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionUpdateParamsRequest_ActionEndConversation(EndConversationActionUpdateParams): - type: typing_extensions.Literal["action_end_conversation"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionUpdateParamsRequest_ActionDtmf(DtmfActionUpdateParams): - type: typing_extensions.Literal["action_dtmf"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionUpdateParamsRequest_ActionAddToConference(AddToConferenceActionUpdateParams): - type: typing_extensions.Literal["action_add_to_conference"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionUpdateParamsRequest_ActionSetHold(SetHoldActionUpdateParams): - type: typing_extensions.Literal["action_set_hold"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ActionUpdateParamsRequest_ActionExternal(ExternalActionUpdateParams): - type: typing_extensions.Literal["action_external"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - ActionUpdateParamsRequest = typing.Union[ - ActionUpdateParamsRequest_ActionTransferCall, - ActionUpdateParamsRequest_ActionEndConversation, - ActionUpdateParamsRequest_ActionDtmf, - ActionUpdateParamsRequest_ActionAddToConference, - ActionUpdateParamsRequest_ActionSetHold, - ActionUpdateParamsRequest_ActionExternal, + AddToConferenceActionUpdateParams, + DtmfActionUpdateParams, + EndConversationActionUpdateParams, + ExternalActionUpdateParams, + SetHoldActionUpdateParams, + TransferCallActionUpdateParams, ] diff --git a/src/vocode/types/add_to_conference_action.py b/src/vocode/types/add_to_conference_action.py index 066ea02..527bb86 100644 --- a/src/vocode/types/add_to_conference_action.py +++ b/src/vocode/types/add_to_conference_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .add_to_conference_action_action_trigger import AddToConferenceActionActionTrigger from .add_to_conference_config import AddToConferenceConfig - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .add_to_conference_action_action_trigger import AddToConferenceActionActionTrigger +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class AddToConferenceAction(pydantic.BaseModel): +class AddToConferenceAction(UniversalBaseModel): id: str user_id: str + type: typing.Literal["action_add_to_conference"] = "action_add_to_conference" config: AddToConferenceConfig - action_trigger: typing.Optional[AddToConferenceActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + action_trigger: typing.Optional[AddToConferenceActionActionTrigger] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/add_to_conference_action_action_trigger.py b/src/vocode/types/add_to_conference_action_action_trigger.py index 70e215b..9c6b3a5 100644 --- a/src/vocode/types/add_to_conference_action_action_trigger.py +++ b/src/vocode/types/add_to_conference_action_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class AddToConferenceActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AddToConferenceActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_output import PhraseBasedActionTriggerOutput -AddToConferenceActionActionTrigger = typing.Union[ - AddToConferenceActionActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionActionTrigger_ActionTriggerPhraseBased, -] +AddToConferenceActionActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerOutput] diff --git a/src/vocode/types/add_to_conference_action_params_action_trigger.py b/src/vocode/types/add_to_conference_action_params_action_trigger.py index 7ac1a68..4278947 100644 --- a/src/vocode/types/add_to_conference_action_params_action_trigger.py +++ b/src/vocode/types/add_to_conference_action_params_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -AddToConferenceActionParamsActionTrigger = typing.Union[ - AddToConferenceActionParamsActionTrigger_ActionTriggerFunctionCall, - AddToConferenceActionParamsActionTrigger_ActionTriggerPhraseBased, -] +AddToConferenceActionParamsActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/add_to_conference_action_update_params_action_trigger.py b/src/vocode/types/add_to_conference_action_update_params_action_trigger.py index 26f60f9..e879fc4 100644 --- a/src/vocode/types/add_to_conference_action_update_params_action_trigger.py +++ b/src/vocode/types/add_to_conference_action_update_params_action_trigger.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .add_to_conference_action_update_params_action_trigger_zero import ( AddToConferenceActionUpdateParamsActionTriggerZero, ) diff --git a/src/vocode/types/add_to_conference_action_update_params_action_trigger_zero.py b/src/vocode/types/add_to_conference_action_update_params_action_trigger_zero.py index 2667f45..53739ce 100644 --- a/src/vocode/types/add_to_conference_action_update_params_action_trigger_zero.py +++ b/src/vocode/types/add_to_conference_action_update_params_action_trigger_zero.py @@ -1,34 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput AddToConferenceActionUpdateParamsActionTriggerZero = typing.Union[ - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - AddToConferenceActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, + FunctionCallActionTrigger, PhraseBasedActionTriggerInput ] diff --git a/src/vocode/types/add_to_conference_action_update_params_config.py b/src/vocode/types/add_to_conference_action_update_params_config.py index 26460f3..98496ce 100644 --- a/src/vocode/types/add_to_conference_action_update_params_config.py +++ b/src/vocode/types/add_to_conference_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .add_to_conference_config import AddToConferenceConfig from .undefined import Undefined diff --git a/src/vocode/types/add_to_conference_config.py b/src/vocode/types/add_to_conference_config.py index 4469b45..4ac3b6f 100644 --- a/src/vocode/types/add_to_conference_config.py +++ b/src/vocode/types/add_to_conference_config.py @@ -1,29 +1,20 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class AddToConferenceConfig(pydantic.BaseModel): +class AddToConferenceConfig(UniversalBaseModel): phone_number: str - place_primary_on_hold: typing.Optional[bool] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + place_primary_on_hold: typing.Optional[bool] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/add_to_steering_pool_body.py b/src/vocode/types/add_to_steering_pool_body.py new file mode 100644 index 0000000..a2acb56 --- /dev/null +++ b/src/vocode/types/add_to_steering_pool_body.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class AddToSteeringPoolBody(UniversalBaseModel): + phone_number: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/agent.py b/src/vocode/types/agent.py index 8245cea..be0d500 100644 --- a/src/vocode/types/agent.py +++ b/src/vocode/types/agent.py @@ -1,59 +1,54 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime +from .prompt import Prompt +from .language import Language from .agent_actions_item import AgentActionsItem -from .agent_endpointing_sensitivity import AgentEndpointingSensitivity -from .agent_ivr_navigation_mode import AgentIvrNavigationMode from .agent_voice import AgentVoice +from .webhook import Webhook +from .pinecone_vector_database import PineconeVectorDatabase from .interrupt_sensitivity import InterruptSensitivity -from .language import Language +from .agent_endpointing_sensitivity import AgentEndpointingSensitivity +from .agent_ivr_navigation_mode import AgentIvrNavigationMode from .open_ai_account_connection import OpenAiAccountConnection -from .pinecone_vector_database import PineconeVectorDatabase -from .prompt import Prompt -from .webhook import Webhook +from .internal_llm_fallback import InternalLlmFallback +from .agent_deepgram_keywords_value import AgentDeepgramKeywordsValue +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -class Agent(pydantic.BaseModel): +class Agent(UniversalBaseModel): id: str user_id: str - name: typing.Optional[str] + name: typing.Optional[str] = None prompt: Prompt - language: typing.Optional[Language] + language: typing.Optional[Language] = None actions: typing.List[AgentActionsItem] voice: AgentVoice - initial_message: typing.Optional[str] - webhook: typing.Optional[Webhook] - vector_database: typing.Optional[PineconeVectorDatabase] - interrupt_sensitivity: typing.Optional[InterruptSensitivity] - context_endpoint: typing.Optional[str] - noise_suppression: typing.Optional[bool] - endpointing_sensitivity: typing.Optional[AgentEndpointingSensitivity] - ivr_navigation_mode: typing.Optional[AgentIvrNavigationMode] - conversation_speed: typing.Optional[float] - initial_message_delay: typing.Optional[float] - openai_model_name_override: typing.Optional[str] - ask_if_human_present_on_idle: typing.Optional[bool] - openai_account_connection: typing.Optional[OpenAiAccountConnection] - run_do_not_call_detection: typing.Optional[bool] - llm_temperature: typing.Optional[float] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + initial_message: typing.Optional[str] = None + webhook: typing.Optional[Webhook] = None + vector_database: typing.Optional[PineconeVectorDatabase] = None + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = None + context_endpoint: typing.Optional[str] = None + noise_suppression: typing.Optional[bool] = None + endpointing_sensitivity: typing.Optional[AgentEndpointingSensitivity] = None + ivr_navigation_mode: typing.Optional[AgentIvrNavigationMode] = None + conversation_speed: typing.Optional[float] = None + initial_message_delay: typing.Optional[float] = None + openai_model_name_override: typing.Optional[str] = None + ask_if_human_present_on_idle: typing.Optional[bool] = None + openai_account_connection: typing.Optional[OpenAiAccountConnection] = None + run_do_not_call_detection: typing.Optional[bool] = None + llm_fallback: typing.Optional[InternalLlmFallback] = None + deepgram_keywords: typing.Optional[typing.Dict[str, typing.Optional[AgentDeepgramKeywordsValue]]] = None + llm_temperature: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/agent_actions_item.py b/src/vocode/types/agent_actions_item.py index ca61bd6..633a0a3 100644 --- a/src/vocode/types/agent_actions_item.py +++ b/src/vocode/types/agent_actions_item.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .add_to_conference_action import AddToConferenceAction from .dtmf_action import DtmfAction from .end_conversation_action import EndConversationAction @@ -13,66 +8,6 @@ from .set_hold_action import SetHoldAction from .transfer_call_action import TransferCallAction - -class AgentActionsItem_ActionTransferCall(TransferCallAction): - type: typing_extensions.Literal["action_transfer_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentActionsItem_ActionEndConversation(EndConversationAction): - type: typing_extensions.Literal["action_end_conversation"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentActionsItem_ActionDtmf(DtmfAction): - type: typing_extensions.Literal["action_dtmf"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentActionsItem_ActionAddToConference(AddToConferenceAction): - type: typing_extensions.Literal["action_add_to_conference"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentActionsItem_ActionSetHold(SetHoldAction): - type: typing_extensions.Literal["action_set_hold"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentActionsItem_ActionExternal(ExternalAction): - type: typing_extensions.Literal["action_external"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - AgentActionsItem = typing.Union[ - AgentActionsItem_ActionTransferCall, - AgentActionsItem_ActionEndConversation, - AgentActionsItem_ActionDtmf, - AgentActionsItem_ActionAddToConference, - AgentActionsItem_ActionSetHold, - AgentActionsItem_ActionExternal, + AddToConferenceAction, DtmfAction, EndConversationAction, ExternalAction, SetHoldAction, TransferCallAction ] diff --git a/src/vocode/types/agent_deepgram_keywords_value.py b/src/vocode/types/agent_deepgram_keywords_value.py new file mode 100644 index 0000000..0e1b732 --- /dev/null +++ b/src/vocode/types/agent_deepgram_keywords_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentDeepgramKeywordsValue = typing.Union[int, float] diff --git a/src/vocode/types/agent_endpointing_sensitivity.py b/src/vocode/types/agent_endpointing_sensitivity.py index 94b908f..da02f48 100644 --- a/src/vocode/types/agent_endpointing_sensitivity.py +++ b/src/vocode/types/agent_endpointing_sensitivity.py @@ -1,25 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class AgentEndpointingSensitivity(str, enum.Enum): - AUTO = "auto" - RELAXED = "relaxed" - SENSITIVE = "sensitive" - - def visit( - self, - auto: typing.Callable[[], T_Result], - relaxed: typing.Callable[[], T_Result], - sensitive: typing.Callable[[], T_Result], - ) -> T_Result: - if self is AgentEndpointingSensitivity.AUTO: - return auto() - if self is AgentEndpointingSensitivity.RELAXED: - return relaxed() - if self is AgentEndpointingSensitivity.SENSITIVE: - return sensitive() +AgentEndpointingSensitivity = typing.Union[typing.Literal["auto", "relaxed", "sensitive"], typing.Any] diff --git a/src/vocode/types/agent_ivr_navigation_mode.py b/src/vocode/types/agent_ivr_navigation_mode.py index 89bb7b2..4d28cc8 100644 --- a/src/vocode/types/agent_ivr_navigation_mode.py +++ b/src/vocode/types/agent_ivr_navigation_mode.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class AgentIvrNavigationMode(str, enum.Enum): - DEFAULT = "default" - OFF = "off" - - def visit(self, default: typing.Callable[[], T_Result], off: typing.Callable[[], T_Result]) -> T_Result: - if self is AgentIvrNavigationMode.DEFAULT: - return default() - if self is AgentIvrNavigationMode.OFF: - return off() +AgentIvrNavigationMode = typing.Union[typing.Literal["default", "off"], typing.Any] diff --git a/src/vocode/types/agent_page.py b/src/vocode/types/agent_page.py index b967bfe..0f91817 100644 --- a/src/vocode/types/agent_page.py +++ b/src/vocode/types/agent_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .normalized_agent import NormalizedAgent - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class AgentPage(pydantic.BaseModel): +class AgentPage(UniversalBaseModel): items: typing.List[NormalizedAgent] page: int size: int @@ -20,15 +15,11 @@ class AgentPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/agent_params.py b/src/vocode/types/agent_params.py new file mode 100644 index 0000000..e9104ea --- /dev/null +++ b/src/vocode/types/agent_params.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from .agent_params_prompt import AgentParamsPrompt +from .language import Language +from .agent_params_actions_item import AgentParamsActionsItem +from .agent_params_voice import AgentParamsVoice +from .agent_params_webhook import AgentParamsWebhook +from .agent_params_vector_database import AgentParamsVectorDatabase +from .interrupt_sensitivity import InterruptSensitivity +from .agent_params_endpointing_sensitivity import AgentParamsEndpointingSensitivity +from .agent_params_ivr_navigation_mode import AgentParamsIvrNavigationMode +from .agent_params_openai_account_connection import AgentParamsOpenaiAccountConnection +from .internal_llm_fallback import InternalLlmFallback +from .agent_params_deepgram_keywords_value import AgentParamsDeepgramKeywordsValue +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class AgentParams(UniversalBaseModel): + name: typing.Optional[str] = None + prompt: AgentParamsPrompt + language: typing.Optional[Language] = None + actions: typing.Optional[typing.List[AgentParamsActionsItem]] = None + voice: AgentParamsVoice + initial_message: typing.Optional[str] = None + webhook: typing.Optional[AgentParamsWebhook] = None + vector_database: typing.Optional[AgentParamsVectorDatabase] = None + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = None + context_endpoint: typing.Optional[str] = None + noise_suppression: typing.Optional[bool] = None + endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = None + ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = None + conversation_speed: typing.Optional[float] = None + initial_message_delay: typing.Optional[float] = None + openai_model_name_override: typing.Optional[str] = None + ask_if_human_present_on_idle: typing.Optional[bool] = None + openai_account_connection: typing.Optional[AgentParamsOpenaiAccountConnection] = None + run_do_not_call_detection: typing.Optional[bool] = None + llm_fallback: typing.Optional[InternalLlmFallback] = None + deepgram_keywords: typing.Optional[typing.Dict[str, typing.Optional[AgentParamsDeepgramKeywordsValue]]] = None + llm_temperature: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/resources/agents/types/agent_params_actions_item.py b/src/vocode/types/agent_params_actions_item.py similarity index 99% rename from src/vocode/resources/agents/types/agent_params_actions_item.py rename to src/vocode/types/agent_params_actions_item.py index f4fc9c2..268c06a 100644 --- a/src/vocode/resources/agents/types/agent_params_actions_item.py +++ b/src/vocode/types/agent_params_actions_item.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .agent_params_actions_item_one import AgentParamsActionsItemOne AgentParamsActionsItem = typing.Union[str, AgentParamsActionsItemOne] diff --git a/src/vocode/types/agent_params_actions_item_one.py b/src/vocode/types/agent_params_actions_item_one.py new file mode 100644 index 0000000..12b650a --- /dev/null +++ b/src/vocode/types/agent_params_actions_item_one.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .add_to_conference_action_params import AddToConferenceActionParams +from .dtmf_action_params import DtmfActionParams +from .end_conversation_action_params import EndConversationActionParams +from .external_action_params import ExternalActionParams +from .set_hold_action_params import SetHoldActionParams +from .transfer_call_action_params import TransferCallActionParams + +AgentParamsActionsItemOne = typing.Union[ + AddToConferenceActionParams, + DtmfActionParams, + EndConversationActionParams, + ExternalActionParams, + SetHoldActionParams, + TransferCallActionParams, +] diff --git a/src/vocode/types/agent_params_deepgram_keywords_value.py b/src/vocode/types/agent_params_deepgram_keywords_value.py new file mode 100644 index 0000000..9ed00ec --- /dev/null +++ b/src/vocode/types/agent_params_deepgram_keywords_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentParamsDeepgramKeywordsValue = typing.Union[int, float] diff --git a/src/vocode/types/agent_params_endpointing_sensitivity.py b/src/vocode/types/agent_params_endpointing_sensitivity.py new file mode 100644 index 0000000..276de7b --- /dev/null +++ b/src/vocode/types/agent_params_endpointing_sensitivity.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentParamsEndpointingSensitivity = typing.Union[typing.Literal["auto", "relaxed", "sensitive"], typing.Any] diff --git a/src/vocode/types/agent_params_ivr_navigation_mode.py b/src/vocode/types/agent_params_ivr_navigation_mode.py new file mode 100644 index 0000000..273f4d2 --- /dev/null +++ b/src/vocode/types/agent_params_ivr_navigation_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentParamsIvrNavigationMode = typing.Union[typing.Literal["default", "off"], typing.Any] diff --git a/src/vocode/resources/agents/types/agent_params_openai_account_connection.py b/src/vocode/types/agent_params_openai_account_connection.py similarity index 68% rename from src/vocode/resources/agents/types/agent_params_openai_account_connection.py rename to src/vocode/types/agent_params_openai_account_connection.py index 100494d..b5a7cfc 100644 --- a/src/vocode/resources/agents/types/agent_params_openai_account_connection.py +++ b/src/vocode/types/agent_params_openai_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.open_ai_account_connection import OpenAiAccountConnection +from .open_ai_account_connection import OpenAiAccountConnection AgentParamsOpenaiAccountConnection = typing.Union[OpenAiAccountConnection, str] diff --git a/src/vocode/resources/agents/types/agent_params_prompt.py b/src/vocode/types/agent_params_prompt.py similarity index 72% rename from src/vocode/resources/agents/types/agent_params_prompt.py rename to src/vocode/types/agent_params_prompt.py index 3486155..bf3c914 100644 --- a/src/vocode/resources/agents/types/agent_params_prompt.py +++ b/src/vocode/types/agent_params_prompt.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.prompt_params import PromptParams +from .prompt_params import PromptParams AgentParamsPrompt = typing.Union[str, PromptParams] diff --git a/src/vocode/resources/agents/types/agent_params_vector_database.py b/src/vocode/types/agent_params_vector_database.py similarity index 65% rename from src/vocode/resources/agents/types/agent_params_vector_database.py rename to src/vocode/types/agent_params_vector_database.py index ee96d56..7e2f6d6 100644 --- a/src/vocode/resources/agents/types/agent_params_vector_database.py +++ b/src/vocode/types/agent_params_vector_database.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.pinecone_vector_database_params import PineconeVectorDatabaseParams +from .pinecone_vector_database_params import PineconeVectorDatabaseParams AgentParamsVectorDatabase = typing.Union[str, PineconeVectorDatabaseParams] diff --git a/src/vocode/resources/agents/types/agent_params_voice.py b/src/vocode/types/agent_params_voice.py similarity index 99% rename from src/vocode/resources/agents/types/agent_params_voice.py rename to src/vocode/types/agent_params_voice.py index dbfaf63..46ea876 100644 --- a/src/vocode/resources/agents/types/agent_params_voice.py +++ b/src/vocode/types/agent_params_voice.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .agent_params_voice_one import AgentParamsVoiceOne AgentParamsVoice = typing.Union[str, AgentParamsVoiceOne] diff --git a/src/vocode/types/agent_params_voice_one.py b/src/vocode/types/agent_params_voice_one.py new file mode 100644 index 0000000..0d91431 --- /dev/null +++ b/src/vocode/types/agent_params_voice_one.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .azure_voice_params import AzureVoiceParams +from .eleven_labs_voice_params import ElevenLabsVoiceParams +from .play_ht_voice_params import PlayHtVoiceParams +from .rime_voice_params import RimeVoiceParams +from .vocode_voice_params import VocodeVoiceParams + +AgentParamsVoiceOne = typing.Union[ + AzureVoiceParams, ElevenLabsVoiceParams, PlayHtVoiceParams, RimeVoiceParams, VocodeVoiceParams +] diff --git a/src/vocode/resources/agents/types/agent_params_webhook.py b/src/vocode/types/agent_params_webhook.py similarity index 72% rename from src/vocode/resources/agents/types/agent_params_webhook.py rename to src/vocode/types/agent_params_webhook.py index 66ab896..f612ce6 100644 --- a/src/vocode/resources/agents/types/agent_params_webhook.py +++ b/src/vocode/types/agent_params_webhook.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from ....types.webhook_params import WebhookParams +from .webhook_params import WebhookParams AgentParamsWebhook = typing.Union[str, WebhookParams] diff --git a/src/vocode/types/agent_update_params.py b/src/vocode/types/agent_update_params.py index 9d40f75..93dc160 100644 --- a/src/vocode/types/agent_update_params.py +++ b/src/vocode/types/agent_update_params.py @@ -1,65 +1,60 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime +from .agent_update_params_name import AgentUpdateParamsName +from .agent_update_params_prompt import AgentUpdateParamsPrompt +from .agent_update_params_language import AgentUpdateParamsLanguage from .agent_update_params_actions import AgentUpdateParamsActions -from .agent_update_params_ask_if_human_present_on_idle import AgentUpdateParamsAskIfHumanPresentOnIdle -from .agent_update_params_context_endpoint import AgentUpdateParamsContextEndpoint -from .agent_update_params_conversation_speed import AgentUpdateParamsConversationSpeed -from .agent_update_params_endpointing_sensitivity import AgentUpdateParamsEndpointingSensitivity +from .agent_update_params_voice import AgentUpdateParamsVoice from .agent_update_params_initial_message import AgentUpdateParamsInitialMessage -from .agent_update_params_initial_message_delay import AgentUpdateParamsInitialMessageDelay +from .agent_update_params_webhook import AgentUpdateParamsWebhook +from .agent_update_params_vector_database import AgentUpdateParamsVectorDatabase from .agent_update_params_interrupt_sensitivity import AgentUpdateParamsInterruptSensitivity -from .agent_update_params_ivr_navigation_mode import AgentUpdateParamsIvrNavigationMode -from .agent_update_params_language import AgentUpdateParamsLanguage -from .agent_update_params_name import AgentUpdateParamsName +from .agent_update_params_context_endpoint import AgentUpdateParamsContextEndpoint from .agent_update_params_noise_suppression import AgentUpdateParamsNoiseSuppression -from .agent_update_params_openai_account_connection import AgentUpdateParamsOpenaiAccountConnection +from .agent_update_params_endpointing_sensitivity import AgentUpdateParamsEndpointingSensitivity +from .agent_update_params_ivr_navigation_mode import AgentUpdateParamsIvrNavigationMode +from .agent_update_params_conversation_speed import AgentUpdateParamsConversationSpeed +from .agent_update_params_initial_message_delay import AgentUpdateParamsInitialMessageDelay from .agent_update_params_openai_model_name_override import AgentUpdateParamsOpenaiModelNameOverride -from .agent_update_params_prompt import AgentUpdateParamsPrompt +from .agent_update_params_ask_if_human_present_on_idle import AgentUpdateParamsAskIfHumanPresentOnIdle +from .agent_update_params_openai_account_connection import AgentUpdateParamsOpenaiAccountConnection from .agent_update_params_run_do_not_call_detection import AgentUpdateParamsRunDoNotCallDetection -from .agent_update_params_vector_database import AgentUpdateParamsVectorDatabase -from .agent_update_params_voice import AgentUpdateParamsVoice -from .agent_update_params_webhook import AgentUpdateParamsWebhook - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class AgentUpdateParams(pydantic.BaseModel): - name: typing.Optional[AgentUpdateParamsName] - prompt: typing.Optional[AgentUpdateParamsPrompt] - language: typing.Optional[AgentUpdateParamsLanguage] - actions: typing.Optional[AgentUpdateParamsActions] - voice: typing.Optional[AgentUpdateParamsVoice] - initial_message: typing.Optional[AgentUpdateParamsInitialMessage] - webhook: typing.Optional[AgentUpdateParamsWebhook] - vector_database: typing.Optional[AgentUpdateParamsVectorDatabase] - interrupt_sensitivity: typing.Optional[AgentUpdateParamsInterruptSensitivity] - context_endpoint: typing.Optional[AgentUpdateParamsContextEndpoint] - noise_suppression: typing.Optional[AgentUpdateParamsNoiseSuppression] - endpointing_sensitivity: typing.Optional[AgentUpdateParamsEndpointingSensitivity] - ivr_navigation_mode: typing.Optional[AgentUpdateParamsIvrNavigationMode] - conversation_speed: typing.Optional[AgentUpdateParamsConversationSpeed] - initial_message_delay: typing.Optional[AgentUpdateParamsInitialMessageDelay] - openai_model_name_override: typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] - ask_if_human_present_on_idle: typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] - openai_account_connection: typing.Optional[AgentUpdateParamsOpenaiAccountConnection] - run_do_not_call_detection: typing.Optional[AgentUpdateParamsRunDoNotCallDetection] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} +from .agent_update_params_llm_fallback import AgentUpdateParamsLlmFallback +from .agent_update_params_deepgram_keywords import AgentUpdateParamsDeepgramKeywords +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class AgentUpdateParams(UniversalBaseModel): + name: typing.Optional[AgentUpdateParamsName] = None + prompt: typing.Optional[AgentUpdateParamsPrompt] = None + language: typing.Optional[AgentUpdateParamsLanguage] = None + actions: typing.Optional[AgentUpdateParamsActions] = None + voice: typing.Optional[AgentUpdateParamsVoice] = None + initial_message: typing.Optional[AgentUpdateParamsInitialMessage] = None + webhook: typing.Optional[AgentUpdateParamsWebhook] = None + vector_database: typing.Optional[AgentUpdateParamsVectorDatabase] = None + interrupt_sensitivity: typing.Optional[AgentUpdateParamsInterruptSensitivity] = None + context_endpoint: typing.Optional[AgentUpdateParamsContextEndpoint] = None + noise_suppression: typing.Optional[AgentUpdateParamsNoiseSuppression] = None + endpointing_sensitivity: typing.Optional[AgentUpdateParamsEndpointingSensitivity] = None + ivr_navigation_mode: typing.Optional[AgentUpdateParamsIvrNavigationMode] = None + conversation_speed: typing.Optional[AgentUpdateParamsConversationSpeed] = None + initial_message_delay: typing.Optional[AgentUpdateParamsInitialMessageDelay] = None + openai_model_name_override: typing.Optional[AgentUpdateParamsOpenaiModelNameOverride] = None + ask_if_human_present_on_idle: typing.Optional[AgentUpdateParamsAskIfHumanPresentOnIdle] = None + openai_account_connection: typing.Optional[AgentUpdateParamsOpenaiAccountConnection] = None + run_do_not_call_detection: typing.Optional[AgentUpdateParamsRunDoNotCallDetection] = None + llm_fallback: typing.Optional[AgentUpdateParamsLlmFallback] = None + deepgram_keywords: typing.Optional[AgentUpdateParamsDeepgramKeywords] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/agent_update_params_actions.py b/src/vocode/types/agent_update_params_actions.py index 9643963..eab5557 100644 --- a/src/vocode/types/agent_update_params_actions.py +++ b/src/vocode/types/agent_update_params_actions.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .agent_update_params_actions_item import AgentUpdateParamsActionsItem from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_actions_item.py b/src/vocode/types/agent_update_params_actions_item.py index 42e7e59..cbfa9a8 100644 --- a/src/vocode/types/agent_update_params_actions_item.py +++ b/src/vocode/types/agent_update_params_actions_item.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .agent_update_params_actions_item_one import AgentUpdateParamsActionsItemOne AgentUpdateParamsActionsItem = typing.Union[str, AgentUpdateParamsActionsItemOne] diff --git a/src/vocode/types/agent_update_params_ask_if_human_present_on_idle.py b/src/vocode/types/agent_update_params_ask_if_human_present_on_idle.py index 4b90af0..ccb909d 100644 --- a/src/vocode/types/agent_update_params_ask_if_human_present_on_idle.py +++ b/src/vocode/types/agent_update_params_ask_if_human_present_on_idle.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsAskIfHumanPresentOnIdle = typing.Union[bool, Undefined] diff --git a/src/vocode/types/agent_update_params_context_endpoint.py b/src/vocode/types/agent_update_params_context_endpoint.py index 8dfe171..62ed53c 100644 --- a/src/vocode/types/agent_update_params_context_endpoint.py +++ b/src/vocode/types/agent_update_params_context_endpoint.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsContextEndpoint = typing.Union[str, Undefined] diff --git a/src/vocode/types/agent_update_params_conversation_speed.py b/src/vocode/types/agent_update_params_conversation_speed.py index 8c66049..8f42858 100644 --- a/src/vocode/types/agent_update_params_conversation_speed.py +++ b/src/vocode/types/agent_update_params_conversation_speed.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsConversationSpeed = typing.Union[float, Undefined] diff --git a/src/vocode/types/agent_update_params_deepgram_keywords.py b/src/vocode/types/agent_update_params_deepgram_keywords.py new file mode 100644 index 0000000..a548860 --- /dev/null +++ b/src/vocode/types/agent_update_params_deepgram_keywords.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .agent_update_params_deepgram_keywords_zero_value import AgentUpdateParamsDeepgramKeywordsZeroValue +from .undefined import Undefined + +AgentUpdateParamsDeepgramKeywords = typing.Union[ + typing.Dict[str, AgentUpdateParamsDeepgramKeywordsZeroValue], Undefined +] diff --git a/src/vocode/types/agent_update_params_deepgram_keywords_zero_value.py b/src/vocode/types/agent_update_params_deepgram_keywords_zero_value.py new file mode 100644 index 0000000..32edd0e --- /dev/null +++ b/src/vocode/types/agent_update_params_deepgram_keywords_zero_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentUpdateParamsDeepgramKeywordsZeroValue = typing.Union[int, float] diff --git a/src/vocode/types/agent_update_params_endpointing_sensitivity.py b/src/vocode/types/agent_update_params_endpointing_sensitivity.py index 2df2297..9a1f037 100644 --- a/src/vocode/types/agent_update_params_endpointing_sensitivity.py +++ b/src/vocode/types/agent_update_params_endpointing_sensitivity.py @@ -1,14 +1,8 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined AgentUpdateParamsEndpointingSensitivity = typing.Union[ - typing_extensions.Literal["auto"], - typing_extensions.Literal["relaxed"], - typing_extensions.Literal["sensitive"], - Undefined, + typing.Literal["auto"], typing.Literal["relaxed"], typing.Literal["sensitive"], Undefined ] diff --git a/src/vocode/types/agent_update_params_initial_message.py b/src/vocode/types/agent_update_params_initial_message.py index 5cef79a..5affbb4 100644 --- a/src/vocode/types/agent_update_params_initial_message.py +++ b/src/vocode/types/agent_update_params_initial_message.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsInitialMessage = typing.Union[str, Undefined] diff --git a/src/vocode/types/agent_update_params_initial_message_delay.py b/src/vocode/types/agent_update_params_initial_message_delay.py index dc5dfa1..4ef236e 100644 --- a/src/vocode/types/agent_update_params_initial_message_delay.py +++ b/src/vocode/types/agent_update_params_initial_message_delay.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsInitialMessageDelay = typing.Union[float, Undefined] diff --git a/src/vocode/types/agent_update_params_interrupt_sensitivity.py b/src/vocode/types/agent_update_params_interrupt_sensitivity.py index d4adf2e..5df1664 100644 --- a/src/vocode/types/agent_update_params_interrupt_sensitivity.py +++ b/src/vocode/types/agent_update_params_interrupt_sensitivity.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .interrupt_sensitivity import InterruptSensitivity from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_ivr_navigation_mode.py b/src/vocode/types/agent_update_params_ivr_navigation_mode.py index b4d7234..381a392 100644 --- a/src/vocode/types/agent_update_params_ivr_navigation_mode.py +++ b/src/vocode/types/agent_update_params_ivr_navigation_mode.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined -AgentUpdateParamsIvrNavigationMode = typing.Union[ - typing_extensions.Literal["default"], typing_extensions.Literal["off"], Undefined -] +AgentUpdateParamsIvrNavigationMode = typing.Union[typing.Literal["default"], typing.Literal["off"], Undefined] diff --git a/src/vocode/types/agent_update_params_language.py b/src/vocode/types/agent_update_params_language.py index 5e8c367..56ad701 100644 --- a/src/vocode/types/agent_update_params_language.py +++ b/src/vocode/types/agent_update_params_language.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .language import Language from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_llm_fallback.py b/src/vocode/types/agent_update_params_llm_fallback.py new file mode 100644 index 0000000..75a0c47 --- /dev/null +++ b/src/vocode/types/agent_update_params_llm_fallback.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .internal_llm_fallback import InternalLlmFallback +from .undefined import Undefined + +AgentUpdateParamsLlmFallback = typing.Union[InternalLlmFallback, Undefined] diff --git a/src/vocode/types/agent_update_params_name.py b/src/vocode/types/agent_update_params_name.py index 190dda7..81fa01d 100644 --- a/src/vocode/types/agent_update_params_name.py +++ b/src/vocode/types/agent_update_params_name.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsName = typing.Union[str, Undefined] diff --git a/src/vocode/types/agent_update_params_noise_suppression.py b/src/vocode/types/agent_update_params_noise_suppression.py index 6e44c14..8658ea1 100644 --- a/src/vocode/types/agent_update_params_noise_suppression.py +++ b/src/vocode/types/agent_update_params_noise_suppression.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsNoiseSuppression = typing.Union[bool, Undefined] diff --git a/src/vocode/types/agent_update_params_openai_account_connection.py b/src/vocode/types/agent_update_params_openai_account_connection.py index fadb77f..18358ad 100644 --- a/src/vocode/types/agent_update_params_openai_account_connection.py +++ b/src/vocode/types/agent_update_params_openai_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .open_ai_account_connection import OpenAiAccountConnection from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_openai_model_name_override.py b/src/vocode/types/agent_update_params_openai_model_name_override.py index 6758cf7..b7b3001 100644 --- a/src/vocode/types/agent_update_params_openai_model_name_override.py +++ b/src/vocode/types/agent_update_params_openai_model_name_override.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsOpenaiModelNameOverride = typing.Union[str, Undefined] diff --git a/src/vocode/types/agent_update_params_prompt.py b/src/vocode/types/agent_update_params_prompt.py index 4acdb52..310afc3 100644 --- a/src/vocode/types/agent_update_params_prompt.py +++ b/src/vocode/types/agent_update_params_prompt.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .prompt_update_params import PromptUpdateParams from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_run_do_not_call_detection.py b/src/vocode/types/agent_update_params_run_do_not_call_detection.py index 5f51ec1..d3fea86 100644 --- a/src/vocode/types/agent_update_params_run_do_not_call_detection.py +++ b/src/vocode/types/agent_update_params_run_do_not_call_detection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AgentUpdateParamsRunDoNotCallDetection = typing.Union[bool, Undefined] diff --git a/src/vocode/types/agent_update_params_vector_database.py b/src/vocode/types/agent_update_params_vector_database.py index ac402df..9e2fbfe 100644 --- a/src/vocode/types/agent_update_params_vector_database.py +++ b/src/vocode/types/agent_update_params_vector_database.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .pinecone_vector_database_update_params import PineconeVectorDatabaseUpdateParams from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_voice.py b/src/vocode/types/agent_update_params_voice.py index 83f633e..2db7bf0 100644 --- a/src/vocode/types/agent_update_params_voice.py +++ b/src/vocode/types/agent_update_params_voice.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .agent_update_params_voice_one import AgentUpdateParamsVoiceOne from .undefined import Undefined diff --git a/src/vocode/types/agent_update_params_webhook.py b/src/vocode/types/agent_update_params_webhook.py index 765fba5..1a25039 100644 --- a/src/vocode/types/agent_update_params_webhook.py +++ b/src/vocode/types/agent_update_params_webhook.py @@ -1,8 +1,7 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from .undefined import Undefined from .webhook_update_params import WebhookUpdateParams +from .undefined import Undefined AgentUpdateParamsWebhook = typing.Union[str, WebhookUpdateParams, Undefined] diff --git a/src/vocode/types/agent_voice.py b/src/vocode/types/agent_voice.py index 46245fe..39e2d32 100644 --- a/src/vocode/types/agent_voice.py +++ b/src/vocode/types/agent_voice.py @@ -1,53 +1,10 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .azure_voice import AzureVoice from .eleven_labs_voice import ElevenLabsVoice from .play_ht_voice import PlayHtVoice from .rime_voice import RimeVoice +from .vocode_voice import VocodeVoice - -class AgentVoice_VoiceAzure(AzureVoice): - type: typing_extensions.Literal["voice_azure"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentVoice_VoiceRime(RimeVoice): - type: typing_extensions.Literal["voice_rime"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentVoice_VoiceElevenLabs(ElevenLabsVoice): - type: typing_extensions.Literal["voice_eleven_labs"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class AgentVoice_VoicePlayHt(PlayHtVoice): - type: typing_extensions.Literal["voice_play_ht"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -AgentVoice = typing.Union[ - AgentVoice_VoiceAzure, AgentVoice_VoiceRime, AgentVoice_VoiceElevenLabs, AgentVoice_VoicePlayHt -] +AgentVoice = typing.Union[AzureVoice, ElevenLabsVoice, PlayHtVoice, RimeVoice, VocodeVoice] diff --git a/src/vocode/types/azure_voice.py b/src/vocode/types/azure_voice.py index b30e14f..fa896d9 100644 --- a/src/vocode/types/azure_voice.py +++ b/src/vocode/types/azure_voice.py @@ -1,32 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class AzureVoice(pydantic.BaseModel): +class AzureVoice(UniversalBaseModel): id: str user_id: str + type: typing.Literal["voice_azure"] = "voice_azure" voice_name: str - pitch: typing.Optional[int] - rate: typing.Optional[int] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + pitch: typing.Optional[int] = None + rate: typing.Optional[int] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/azure_voice_update_params_pitch.py b/src/vocode/types/azure_voice_update_params_pitch.py index 6e66cde..bd2c3ce 100644 --- a/src/vocode/types/azure_voice_update_params_pitch.py +++ b/src/vocode/types/azure_voice_update_params_pitch.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AzureVoiceUpdateParamsPitch = typing.Union[int, Undefined] diff --git a/src/vocode/types/azure_voice_update_params_rate.py b/src/vocode/types/azure_voice_update_params_rate.py index c70c4d3..6f88be1 100644 --- a/src/vocode/types/azure_voice_update_params_rate.py +++ b/src/vocode/types/azure_voice_update_params_rate.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AzureVoiceUpdateParamsRate = typing.Union[int, Undefined] diff --git a/src/vocode/types/azure_voice_update_params_voice_name.py b/src/vocode/types/azure_voice_update_params_voice_name.py index 1a5a39e..9be3632 100644 --- a/src/vocode/types/azure_voice_update_params_voice_name.py +++ b/src/vocode/types/azure_voice_update_params_voice_name.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined AzureVoiceUpdateParamsVoiceName = typing.Union[str, Undefined] diff --git a/src/vocode/types/buy_phone_number_request.py b/src/vocode/types/buy_phone_number_request.py deleted file mode 100644 index 366d1ae..0000000 --- a/src/vocode/types/buy_phone_number_request.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime -from .buy_phone_number_request_telephony_provider import BuyPhoneNumberRequestTelephonyProvider - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class BuyPhoneNumberRequest(pydantic.BaseModel): - area_code: typing.Optional[str] - telephony_provider: typing.Optional[BuyPhoneNumberRequestTelephonyProvider] - telephony_account_connection: typing.Optional[str] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/vocode/types/buy_phone_number_request_telephony_provider.py b/src/vocode/types/buy_phone_number_request_telephony_provider.py deleted file mode 100644 index 8dcd9ea..0000000 --- a/src/vocode/types/buy_phone_number_request_telephony_provider.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class BuyPhoneNumberRequestTelephonyProvider(str, enum.Enum): - VONAGE = "vonage" - TWILIO = "twilio" - - def visit(self, vonage: typing.Callable[[], T_Result], twilio: typing.Callable[[], T_Result]) -> T_Result: - if self is BuyPhoneNumberRequestTelephonyProvider.VONAGE: - return vonage() - if self is BuyPhoneNumberRequestTelephonyProvider.TWILIO: - return twilio() diff --git a/src/vocode/types/call.py b/src/vocode/types/call.py index abeedaf..bc66358 100644 --- a/src/vocode/types/call.py +++ b/src/vocode/types/call.py @@ -1,61 +1,52 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .agent import Agent +from .call_status import CallStatus from .call_human_detection_result import CallHumanDetectionResult -from .call_on_no_human_answer import CallOnNoHumanAnswer from .call_stage import CallStage from .call_stage_outcome import CallStageOutcome -from .call_status import CallStatus from .call_telephony_metadata import CallTelephonyMetadata +from .agent import Agent from .call_telephony_provider import CallTelephonyProvider +from .call_on_no_human_answer import CallOnNoHumanAnswer from .twilio_account_connection import TwilioAccountConnection - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class Call(pydantic.BaseModel): +class Call(UniversalBaseModel): id: str user_id: str - status: typing.Optional[CallStatus] - error_message: typing.Optional[str] - recording_available: typing.Optional[bool] - transcript: typing.Optional[str] - human_detection_result: typing.Optional[CallHumanDetectionResult] - do_not_call_result: typing.Optional[bool] - telephony_id: typing.Optional[str] - stage: typing.Optional[CallStage] - stage_outcome: typing.Optional[CallStageOutcome] - telephony_metadata: typing.Optional[CallTelephonyMetadata] + status: typing.Optional[CallStatus] = None + error_message: typing.Optional[str] = None + recording_available: typing.Optional[bool] = None + transcript: typing.Optional[str] = None + human_detection_result: typing.Optional[CallHumanDetectionResult] = None + do_not_call_result: typing.Optional[bool] = None + telephony_id: typing.Optional[str] = None + stage: typing.Optional[CallStage] = None + stage_outcome: typing.Optional[CallStageOutcome] = None + telephony_metadata: typing.Optional[CallTelephonyMetadata] = None + start_time: typing.Optional[str] = None + end_time: typing.Optional[str] = None to_number: str from_number: str agent: Agent telephony_provider: CallTelephonyProvider agent_phone_number: str - start_time: typing.Optional[dt.datetime] - end_time: typing.Optional[dt.datetime] - hipaa_compliant: typing.Optional[bool] - on_no_human_answer: typing.Optional[CallOnNoHumanAnswer] - context: typing.Optional[typing.Dict[str, str]] - run_do_not_call_detection: typing.Optional[bool] - telephony_account_connection: typing.Optional[TwilioAccountConnection] - telephony_params: typing.Optional[typing.Dict[str, str]] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + hipaa_compliant: typing.Optional[bool] = None + on_no_human_answer: typing.Optional[CallOnNoHumanAnswer] = None + context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + run_do_not_call_detection: typing.Optional[bool] = None + telephony_account_connection: typing.Optional[TwilioAccountConnection] = None + telephony_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/call_human_detection_result.py b/src/vocode/types/call_human_detection_result.py index f28eff7..6ef3be9 100644 --- a/src/vocode/types/call_human_detection_result.py +++ b/src/vocode/types/call_human_detection_result.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallHumanDetectionResult(str, enum.Enum): - HUMAN = "human" - NO_HUMAN = "no_human" - - def visit(self, human: typing.Callable[[], T_Result], no_human: typing.Callable[[], T_Result]) -> T_Result: - if self is CallHumanDetectionResult.HUMAN: - return human() - if self is CallHumanDetectionResult.NO_HUMAN: - return no_human() +CallHumanDetectionResult = typing.Union[typing.Literal["human", "no_human"], typing.Any] diff --git a/src/vocode/types/call_on_no_human_answer.py b/src/vocode/types/call_on_no_human_answer.py index b754b29..6f7ce15 100644 --- a/src/vocode/types/call_on_no_human_answer.py +++ b/src/vocode/types/call_on_no_human_answer.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallOnNoHumanAnswer(str, enum.Enum): - CONTINUE = "continue" - HANGUP = "hangup" - - def visit(self, continue_: typing.Callable[[], T_Result], hangup: typing.Callable[[], T_Result]) -> T_Result: - if self is CallOnNoHumanAnswer.CONTINUE: - return continue_() - if self is CallOnNoHumanAnswer.HANGUP: - return hangup() +CallOnNoHumanAnswer = typing.Union[typing.Literal["continue", "hangup"], typing.Any] diff --git a/src/vocode/types/call_page.py b/src/vocode/types/call_page.py index b0b81c5..3c95734 100644 --- a/src/vocode/types/call_page.py +++ b/src/vocode/types/call_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .normalized_call import NormalizedCall - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class CallPage(pydantic.BaseModel): +class CallPage(UniversalBaseModel): items: typing.List[NormalizedCall] page: int size: int @@ -20,15 +15,11 @@ class CallPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/call_stage.py b/src/vocode/types/call_stage.py index b2450ae..6862908 100644 --- a/src/vocode/types/call_stage.py +++ b/src/vocode/types/call_stage.py @@ -1,29 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallStage(str, enum.Enum): - CREATED = "created" - PICKED_UP = "picked_up" - TRANSFER_STARTED = "transfer_started" - TRANSFER_SUCCESSFUL = "transfer_successful" - - def visit( - self, - created: typing.Callable[[], T_Result], - picked_up: typing.Callable[[], T_Result], - transfer_started: typing.Callable[[], T_Result], - transfer_successful: typing.Callable[[], T_Result], - ) -> T_Result: - if self is CallStage.CREATED: - return created() - if self is CallStage.PICKED_UP: - return picked_up() - if self is CallStage.TRANSFER_STARTED: - return transfer_started() - if self is CallStage.TRANSFER_SUCCESSFUL: - return transfer_successful() +CallStage = typing.Union[typing.Literal["created", "picked_up", "transfer_started", "transfer_successful"], typing.Any] diff --git a/src/vocode/types/call_stage_outcome.py b/src/vocode/types/call_stage_outcome.py index 450478d..3e33303 100644 --- a/src/vocode/types/call_stage_outcome.py +++ b/src/vocode/types/call_stage_outcome.py @@ -1,37 +1,15 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallStageOutcome(str, enum.Enum): - HUMAN_UNANSWERED = "human_unanswered" - CALL_DID_NOT_CONNECT = "call_did_not_connect" - HUMAN_DISCONNECTED = "human_disconnected" - BOT_DISCONNECTED = "bot_disconnected" - TRANSFER_UNANSWERED = "transfer_unanswered" - TRANSFER_DISCONNECTED = "transfer_disconnected" - - def visit( - self, - human_unanswered: typing.Callable[[], T_Result], - call_did_not_connect: typing.Callable[[], T_Result], - human_disconnected: typing.Callable[[], T_Result], - bot_disconnected: typing.Callable[[], T_Result], - transfer_unanswered: typing.Callable[[], T_Result], - transfer_disconnected: typing.Callable[[], T_Result], - ) -> T_Result: - if self is CallStageOutcome.HUMAN_UNANSWERED: - return human_unanswered() - if self is CallStageOutcome.CALL_DID_NOT_CONNECT: - return call_did_not_connect() - if self is CallStageOutcome.HUMAN_DISCONNECTED: - return human_disconnected() - if self is CallStageOutcome.BOT_DISCONNECTED: - return bot_disconnected() - if self is CallStageOutcome.TRANSFER_UNANSWERED: - return transfer_unanswered() - if self is CallStageOutcome.TRANSFER_DISCONNECTED: - return transfer_disconnected() +CallStageOutcome = typing.Union[ + typing.Literal[ + "human_unanswered", + "call_did_not_connect", + "human_disconnected", + "bot_disconnected", + "transfer_unanswered", + "transfer_disconnected", + ], + typing.Any, +] diff --git a/src/vocode/types/call_status.py b/src/vocode/types/call_status.py index 154afab..d5b6f59 100644 --- a/src/vocode/types/call_status.py +++ b/src/vocode/types/call_status.py @@ -1,33 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallStatus(str, enum.Enum): - """ - An enumeration. - """ - - NOT_STARTED = "not_started" - IN_PROGRESS = "in_progress" - ERROR = "error" - ENDED = "ended" - - def visit( - self, - not_started: typing.Callable[[], T_Result], - in_progress: typing.Callable[[], T_Result], - error: typing.Callable[[], T_Result], - ended: typing.Callable[[], T_Result], - ) -> T_Result: - if self is CallStatus.NOT_STARTED: - return not_started() - if self is CallStatus.IN_PROGRESS: - return in_progress() - if self is CallStatus.ERROR: - return error() - if self is CallStatus.ENDED: - return ended() +CallStatus = typing.Union[typing.Literal["not_started", "in_progress", "error", "ended"], typing.Any] diff --git a/src/vocode/types/call_telephony_metadata.py b/src/vocode/types/call_telephony_metadata.py index df336dd..fedb987 100644 --- a/src/vocode/types/call_telephony_metadata.py +++ b/src/vocode/types/call_telephony_metadata.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .twilio_telephony_metadata import TwilioTelephonyMetadata from .vonage_telephony_metadata import VonageTelephonyMetadata - -class CallTelephonyMetadata_TelephonyMetadataVonage(VonageTelephonyMetadata): - type: typing_extensions.Literal["telephony_metadata_vonage"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class CallTelephonyMetadata_TelephonyMetadataTwilio(TwilioTelephonyMetadata): - type: typing_extensions.Literal["telephony_metadata_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -CallTelephonyMetadata = typing.Union[ - CallTelephonyMetadata_TelephonyMetadataVonage, CallTelephonyMetadata_TelephonyMetadataTwilio -] +CallTelephonyMetadata = typing.Union[TwilioTelephonyMetadata, VonageTelephonyMetadata] diff --git a/src/vocode/types/call_telephony_provider.py b/src/vocode/types/call_telephony_provider.py index b91a9bd..f9812a0 100644 --- a/src/vocode/types/call_telephony_provider.py +++ b/src/vocode/types/call_telephony_provider.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CallTelephonyProvider(str, enum.Enum): - VONAGE = "vonage" - TWILIO = "twilio" - - def visit(self, vonage: typing.Callable[[], T_Result], twilio: typing.Callable[[], T_Result]) -> T_Result: - if self is CallTelephonyProvider.VONAGE: - return vonage() - if self is CallTelephonyProvider.TWILIO: - return twilio() +CallTelephonyProvider = typing.Union[typing.Literal["vonage", "twilio"], typing.Any] diff --git a/src/vocode/types/collect_field.py b/src/vocode/types/collect_field.py index 98e0d24..bf33232 100644 --- a/src/vocode/types/collect_field.py +++ b/src/vocode/types/collect_field.py @@ -1,33 +1,22 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -import typing_extensions -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class CollectField(pydantic.BaseModel): - field_type: typing_extensions.Literal["field_type_email"] +class CollectField(UniversalBaseModel): + field_type: typing.Literal["field_type_email"] = "field_type_email" label: str name: str - description: typing.Optional[str] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + description: typing.Optional[str] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/create_call_agent_params.py b/src/vocode/types/create_call_agent_params.py index 761d451..63bc2d0 100644 --- a/src/vocode/types/create_call_agent_params.py +++ b/src/vocode/types/create_call_agent_params.py @@ -1,57 +1,54 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .create_call_agent_params_actions_item import CreateCallAgentParamsActionsItem -from .create_call_agent_params_endpointing_sensitivity import CreateCallAgentParamsEndpointingSensitivity -from .create_call_agent_params_ivr_navigation_mode import CreateCallAgentParamsIvrNavigationMode -from .create_call_agent_params_openai_account_connection import CreateCallAgentParamsOpenaiAccountConnection from .create_call_agent_params_prompt import CreateCallAgentParamsPrompt -from .create_call_agent_params_vector_database import CreateCallAgentParamsVectorDatabase +from .language import Language +from .create_call_agent_params_actions_item import CreateCallAgentParamsActionsItem from .create_call_agent_params_voice import CreateCallAgentParamsVoice from .create_call_agent_params_webhook import CreateCallAgentParamsWebhook +from .create_call_agent_params_vector_database import CreateCallAgentParamsVectorDatabase from .interrupt_sensitivity import InterruptSensitivity -from .language import Language - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .create_call_agent_params_endpointing_sensitivity import CreateCallAgentParamsEndpointingSensitivity +from .create_call_agent_params_ivr_navigation_mode import CreateCallAgentParamsIvrNavigationMode +from .create_call_agent_params_openai_account_connection import CreateCallAgentParamsOpenaiAccountConnection +from .internal_llm_fallback import InternalLlmFallback +from .create_call_agent_params_deepgram_keywords_value import CreateCallAgentParamsDeepgramKeywordsValue +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class CreateCallAgentParams(pydantic.BaseModel): - name: typing.Optional[str] +class CreateCallAgentParams(UniversalBaseModel): + name: typing.Optional[str] = None prompt: CreateCallAgentParamsPrompt - language: typing.Optional[Language] - actions: typing.Optional[typing.List[CreateCallAgentParamsActionsItem]] - voice: typing.Optional[CreateCallAgentParamsVoice] - initial_message: typing.Optional[str] - webhook: typing.Optional[CreateCallAgentParamsWebhook] - vector_database: typing.Optional[CreateCallAgentParamsVectorDatabase] - interrupt_sensitivity: typing.Optional[InterruptSensitivity] - context_endpoint: typing.Optional[str] - noise_suppression: typing.Optional[bool] - endpointing_sensitivity: typing.Optional[CreateCallAgentParamsEndpointingSensitivity] - ivr_navigation_mode: typing.Optional[CreateCallAgentParamsIvrNavigationMode] - conversation_speed: typing.Optional[float] - initial_message_delay: typing.Optional[float] - openai_model_name_override: typing.Optional[str] - ask_if_human_present_on_idle: typing.Optional[bool] - openai_account_connection: typing.Optional[CreateCallAgentParamsOpenaiAccountConnection] - run_do_not_call_detection: typing.Optional[bool] - llm_temperature: typing.Optional[float] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + language: typing.Optional[Language] = None + actions: typing.Optional[typing.List[CreateCallAgentParamsActionsItem]] = None + voice: typing.Optional[CreateCallAgentParamsVoice] = None + initial_message: typing.Optional[str] = None + webhook: typing.Optional[CreateCallAgentParamsWebhook] = None + vector_database: typing.Optional[CreateCallAgentParamsVectorDatabase] = None + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = None + context_endpoint: typing.Optional[str] = None + noise_suppression: typing.Optional[bool] = None + endpointing_sensitivity: typing.Optional[CreateCallAgentParamsEndpointingSensitivity] = None + ivr_navigation_mode: typing.Optional[CreateCallAgentParamsIvrNavigationMode] = None + conversation_speed: typing.Optional[float] = None + initial_message_delay: typing.Optional[float] = None + openai_model_name_override: typing.Optional[str] = None + ask_if_human_present_on_idle: typing.Optional[bool] = None + openai_account_connection: typing.Optional[CreateCallAgentParamsOpenaiAccountConnection] = None + run_do_not_call_detection: typing.Optional[bool] = None + llm_fallback: typing.Optional[InternalLlmFallback] = None + deepgram_keywords: typing.Optional[ + typing.Dict[str, typing.Optional[CreateCallAgentParamsDeepgramKeywordsValue]] + ] = None + llm_temperature: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/create_call_agent_params_actions_item.py b/src/vocode/types/create_call_agent_params_actions_item.py index 2d810e7..baa4fea 100644 --- a/src/vocode/types/create_call_agent_params_actions_item.py +++ b/src/vocode/types/create_call_agent_params_actions_item.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .create_call_agent_params_actions_item_one import CreateCallAgentParamsActionsItemOne CreateCallAgentParamsActionsItem = typing.Union[str, CreateCallAgentParamsActionsItemOne] diff --git a/src/vocode/types/create_call_agent_params_deepgram_keywords_value.py b/src/vocode/types/create_call_agent_params_deepgram_keywords_value.py new file mode 100644 index 0000000..4202b32 --- /dev/null +++ b/src/vocode/types/create_call_agent_params_deepgram_keywords_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateCallAgentParamsDeepgramKeywordsValue = typing.Union[int, float] diff --git a/src/vocode/types/create_call_agent_params_endpointing_sensitivity.py b/src/vocode/types/create_call_agent_params_endpointing_sensitivity.py index cac4805..42ed418 100644 --- a/src/vocode/types/create_call_agent_params_endpointing_sensitivity.py +++ b/src/vocode/types/create_call_agent_params_endpointing_sensitivity.py @@ -1,25 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CreateCallAgentParamsEndpointingSensitivity(str, enum.Enum): - AUTO = "auto" - RELAXED = "relaxed" - SENSITIVE = "sensitive" - - def visit( - self, - auto: typing.Callable[[], T_Result], - relaxed: typing.Callable[[], T_Result], - sensitive: typing.Callable[[], T_Result], - ) -> T_Result: - if self is CreateCallAgentParamsEndpointingSensitivity.AUTO: - return auto() - if self is CreateCallAgentParamsEndpointingSensitivity.RELAXED: - return relaxed() - if self is CreateCallAgentParamsEndpointingSensitivity.SENSITIVE: - return sensitive() +CreateCallAgentParamsEndpointingSensitivity = typing.Union[typing.Literal["auto", "relaxed", "sensitive"], typing.Any] diff --git a/src/vocode/types/create_call_agent_params_ivr_navigation_mode.py b/src/vocode/types/create_call_agent_params_ivr_navigation_mode.py index 6c7d391..25f5cb0 100644 --- a/src/vocode/types/create_call_agent_params_ivr_navigation_mode.py +++ b/src/vocode/types/create_call_agent_params_ivr_navigation_mode.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class CreateCallAgentParamsIvrNavigationMode(str, enum.Enum): - DEFAULT = "default" - OFF = "off" - - def visit(self, default: typing.Callable[[], T_Result], off: typing.Callable[[], T_Result]) -> T_Result: - if self is CreateCallAgentParamsIvrNavigationMode.DEFAULT: - return default() - if self is CreateCallAgentParamsIvrNavigationMode.OFF: - return off() +CreateCallAgentParamsIvrNavigationMode = typing.Union[typing.Literal["default", "off"], typing.Any] diff --git a/src/vocode/types/create_call_agent_params_openai_account_connection.py b/src/vocode/types/create_call_agent_params_openai_account_connection.py index 71e0d04..fb66af5 100644 --- a/src/vocode/types/create_call_agent_params_openai_account_connection.py +++ b/src/vocode/types/create_call_agent_params_openai_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .open_ai_account_connection import OpenAiAccountConnection CreateCallAgentParamsOpenaiAccountConnection = typing.Union[OpenAiAccountConnection, str] diff --git a/src/vocode/types/create_call_agent_params_prompt.py b/src/vocode/types/create_call_agent_params_prompt.py index cdfc80d..c6da613 100644 --- a/src/vocode/types/create_call_agent_params_prompt.py +++ b/src/vocode/types/create_call_agent_params_prompt.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .prompt_params import PromptParams CreateCallAgentParamsPrompt = typing.Union[str, PromptParams] diff --git a/src/vocode/types/create_call_agent_params_vector_database.py b/src/vocode/types/create_call_agent_params_vector_database.py index 77827f8..1c69ac3 100644 --- a/src/vocode/types/create_call_agent_params_vector_database.py +++ b/src/vocode/types/create_call_agent_params_vector_database.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .pinecone_vector_database_params import PineconeVectorDatabaseParams CreateCallAgentParamsVectorDatabase = typing.Union[str, PineconeVectorDatabaseParams] diff --git a/src/vocode/types/create_call_agent_params_voice.py b/src/vocode/types/create_call_agent_params_voice.py index 3921fda..93a4fb2 100644 --- a/src/vocode/types/create_call_agent_params_voice.py +++ b/src/vocode/types/create_call_agent_params_voice.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .create_call_agent_params_voice_one import CreateCallAgentParamsVoiceOne CreateCallAgentParamsVoice = typing.Union[str, CreateCallAgentParamsVoiceOne] diff --git a/src/vocode/types/create_call_agent_params_webhook.py b/src/vocode/types/create_call_agent_params_webhook.py index 92ce76f..d9f0715 100644 --- a/src/vocode/types/create_call_agent_params_webhook.py +++ b/src/vocode/types/create_call_agent_params_webhook.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .webhook_params import WebhookParams CreateCallAgentParamsWebhook = typing.Union[str, WebhookParams] diff --git a/src/vocode/types/dtmf_action.py b/src/vocode/types/dtmf_action.py index b00d096..1601384 100644 --- a/src/vocode/types/dtmf_action.py +++ b/src/vocode/types/dtmf_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .dtmf_action_action_trigger import DtmfActionActionTrigger from .empty_action_config import EmptyActionConfig - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .function_call_action_trigger import FunctionCallActionTrigger +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class DtmfAction(pydantic.BaseModel): +class DtmfAction(UniversalBaseModel): id: str user_id: str - config: typing.Optional[EmptyActionConfig] - action_trigger: typing.Optional[DtmfActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + type: typing.Literal["action_dtmf"] = "action_dtmf" + config: typing.Optional[EmptyActionConfig] = None + action_trigger: typing.Optional[FunctionCallActionTrigger] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/dtmf_action_action_trigger.py b/src/vocode/types/dtmf_action_action_trigger.py deleted file mode 100644 index 1f6596e..0000000 --- a/src/vocode/types/dtmf_action_action_trigger.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class DtmfActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class DtmfActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -DtmfActionActionTrigger = typing.Union[ - DtmfActionActionTrigger_ActionTriggerFunctionCall, DtmfActionActionTrigger_ActionTriggerPhraseBased -] diff --git a/src/vocode/types/dtmf_action_params_action_trigger.py b/src/vocode/types/dtmf_action_params_action_trigger.py deleted file mode 100644 index 2be2441..0000000 --- a/src/vocode/types/dtmf_action_params_action_trigger.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class DtmfActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class DtmfActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -DtmfActionParamsActionTrigger = typing.Union[ - DtmfActionParamsActionTrigger_ActionTriggerFunctionCall, DtmfActionParamsActionTrigger_ActionTriggerPhraseBased -] diff --git a/src/vocode/types/dtmf_action_update_params_action_trigger.py b/src/vocode/types/dtmf_action_update_params_action_trigger.py index ab876e6..cae422e 100644 --- a/src/vocode/types/dtmf_action_update_params_action_trigger.py +++ b/src/vocode/types/dtmf_action_update_params_action_trigger.py @@ -1,8 +1,7 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from .dtmf_action_update_params_action_trigger_zero import DtmfActionUpdateParamsActionTriggerZero +from .function_call_action_trigger import FunctionCallActionTrigger from .undefined import Undefined -DtmfActionUpdateParamsActionTrigger = typing.Union[DtmfActionUpdateParamsActionTriggerZero, Undefined] +DtmfActionUpdateParamsActionTrigger = typing.Union[FunctionCallActionTrigger, Undefined] diff --git a/src/vocode/types/dtmf_action_update_params_action_trigger_zero.py b/src/vocode/types/dtmf_action_update_params_action_trigger_zero.py deleted file mode 100644 index 15b1176..0000000 --- a/src/vocode/types/dtmf_action_update_params_action_trigger_zero.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -DtmfActionUpdateParamsActionTriggerZero = typing.Union[ - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - DtmfActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -] diff --git a/src/vocode/types/dtmf_action_update_params_config.py b/src/vocode/types/dtmf_action_update_params_config.py index 91570b0..e56fa78 100644 --- a/src/vocode/types/dtmf_action_update_params_config.py +++ b/src/vocode/types/dtmf_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .empty_action_config import EmptyActionConfig from .undefined import Undefined diff --git a/src/vocode/types/eleven_labs_voice.py b/src/vocode/types/eleven_labs_voice.py index f9d8e47..2d36d26 100644 --- a/src/vocode/types/eleven_labs_voice.py +++ b/src/vocode/types/eleven_labs_voice.py @@ -1,36 +1,28 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class ElevenLabsVoice(pydantic.BaseModel): +class ElevenLabsVoice(UniversalBaseModel): id: str user_id: str + type: typing.Literal["voice_eleven_labs"] = "voice_eleven_labs" voice_id: str - stability: typing.Optional[float] - similarity_boost: typing.Optional[float] - api_key: typing.Optional[str] - optimize_streaming_latency: typing.Optional[int] - model_id: typing.Optional[str] - experimental_input_streaming: typing.Optional[bool] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + stability: typing.Optional[float] = None + similarity_boost: typing.Optional[float] = None + api_key: typing.Optional[str] = None + optimize_streaming_latency: typing.Optional[int] = None + model_id: typing.Optional[str] = None + experimental_input_streaming: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/eleven_labs_voice_update_params_api_key.py b/src/vocode/types/eleven_labs_voice_update_params_api_key.py index ccc2946..d25af7a 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_api_key.py +++ b/src/vocode/types/eleven_labs_voice_update_params_api_key.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsApiKey = typing.Union[str, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_experimental_input_streaming.py b/src/vocode/types/eleven_labs_voice_update_params_experimental_input_streaming.py index bac6f96..1f0da68 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_experimental_input_streaming.py +++ b/src/vocode/types/eleven_labs_voice_update_params_experimental_input_streaming.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsExperimentalInputStreaming = typing.Union[bool, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_model_id.py b/src/vocode/types/eleven_labs_voice_update_params_model_id.py index abfdf7a..5a02466 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_model_id.py +++ b/src/vocode/types/eleven_labs_voice_update_params_model_id.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsModelId = typing.Union[str, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_optimize_streaming_latency.py b/src/vocode/types/eleven_labs_voice_update_params_optimize_streaming_latency.py index d99181f..8023148 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_optimize_streaming_latency.py +++ b/src/vocode/types/eleven_labs_voice_update_params_optimize_streaming_latency.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsOptimizeStreamingLatency = typing.Union[int, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_similarity_boost.py b/src/vocode/types/eleven_labs_voice_update_params_similarity_boost.py index 426f1a2..0d7f6a0 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_similarity_boost.py +++ b/src/vocode/types/eleven_labs_voice_update_params_similarity_boost.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsSimilarityBoost = typing.Union[float, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_stability.py b/src/vocode/types/eleven_labs_voice_update_params_stability.py index 43470bc..6d80546 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_stability.py +++ b/src/vocode/types/eleven_labs_voice_update_params_stability.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsStability = typing.Union[float, Undefined] diff --git a/src/vocode/types/eleven_labs_voice_update_params_voice_id.py b/src/vocode/types/eleven_labs_voice_update_params_voice_id.py index 4bd2ac0..eff5821 100644 --- a/src/vocode/types/eleven_labs_voice_update_params_voice_id.py +++ b/src/vocode/types/eleven_labs_voice_update_params_voice_id.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined ElevenLabsVoiceUpdateParamsVoiceId = typing.Union[str, Undefined] diff --git a/src/vocode/types/empty_action_config.py b/src/vocode/types/empty_action_config.py index 8a0be38..644d58e 100644 --- a/src/vocode/types/empty_action_config.py +++ b/src/vocode/types/empty_action_config.py @@ -1,26 +1,17 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +class EmptyActionConfig(UniversalBaseModel): + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - -class EmptyActionConfig(pydantic.BaseModel): - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/end_conversation_action.py b/src/vocode/types/end_conversation_action.py index f73cbf1..f0fdfb2 100644 --- a/src/vocode/types/end_conversation_action.py +++ b/src/vocode/types/end_conversation_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .empty_action_config import EmptyActionConfig from .end_conversation_action_action_trigger import EndConversationActionActionTrigger - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class EndConversationAction(pydantic.BaseModel): +class EndConversationAction(UniversalBaseModel): id: str user_id: str - config: typing.Optional[EmptyActionConfig] - action_trigger: typing.Optional[EndConversationActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + type: typing.Literal["action_end_conversation"] = "action_end_conversation" + config: typing.Optional[EmptyActionConfig] = None + action_trigger: typing.Optional[EndConversationActionActionTrigger] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/end_conversation_action_action_trigger.py b/src/vocode/types/end_conversation_action_action_trigger.py index c76240f..9d378d9 100644 --- a/src/vocode/types/end_conversation_action_action_trigger.py +++ b/src/vocode/types/end_conversation_action_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class EndConversationActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class EndConversationActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_output import PhraseBasedActionTriggerOutput -EndConversationActionActionTrigger = typing.Union[ - EndConversationActionActionTrigger_ActionTriggerFunctionCall, - EndConversationActionActionTrigger_ActionTriggerPhraseBased, -] +EndConversationActionActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerOutput] diff --git a/src/vocode/types/end_conversation_action_params_action_trigger.py b/src/vocode/types/end_conversation_action_params_action_trigger.py index 54d7d8f..d2cb9aa 100644 --- a/src/vocode/types/end_conversation_action_params_action_trigger.py +++ b/src/vocode/types/end_conversation_action_params_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -EndConversationActionParamsActionTrigger = typing.Union[ - EndConversationActionParamsActionTrigger_ActionTriggerFunctionCall, - EndConversationActionParamsActionTrigger_ActionTriggerPhraseBased, -] +EndConversationActionParamsActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/end_conversation_action_update_params_action_trigger.py b/src/vocode/types/end_conversation_action_update_params_action_trigger.py index a8c969a..6cc30f9 100644 --- a/src/vocode/types/end_conversation_action_update_params_action_trigger.py +++ b/src/vocode/types/end_conversation_action_update_params_action_trigger.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .end_conversation_action_update_params_action_trigger_zero import ( EndConversationActionUpdateParamsActionTriggerZero, ) diff --git a/src/vocode/types/end_conversation_action_update_params_action_trigger_zero.py b/src/vocode/types/end_conversation_action_update_params_action_trigger_zero.py index 247309a..56aa17a 100644 --- a/src/vocode/types/end_conversation_action_update_params_action_trigger_zero.py +++ b/src/vocode/types/end_conversation_action_update_params_action_trigger_zero.py @@ -1,34 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput EndConversationActionUpdateParamsActionTriggerZero = typing.Union[ - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - EndConversationActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, + FunctionCallActionTrigger, PhraseBasedActionTriggerInput ] diff --git a/src/vocode/types/end_conversation_action_update_params_config.py b/src/vocode/types/end_conversation_action_update_params_config.py index 17c0b7f..3ebae23 100644 --- a/src/vocode/types/end_conversation_action_update_params_config.py +++ b/src/vocode/types/end_conversation_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .empty_action_config import EmptyActionConfig from .undefined import Undefined diff --git a/src/vocode/types/event_type.py b/src/vocode/types/event_type.py index 283acc4..3e6577f 100644 --- a/src/vocode/types/event_type.py +++ b/src/vocode/types/event_type.py @@ -1,49 +1,17 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class EventType(str, enum.Enum): - """ - An enumeration. - """ - - EVENT_MESSAGE = "event_message" - EVENT_ACTION = "event_action" - EVENT_PHONE_CALL_CONNECTED = "event_phone_call_connected" - EVENT_PHONE_CALL_ENDED = "event_phone_call_ended" - EVENT_PHONE_CALL_DID_NOT_CONNECT = "event_phone_call_did_not_connect" - EVENT_TRANSCRIPT = "event_transcript" - EVENT_RECORDING = "event_recording" - EVENT_HUMAN_DETECTION = "event_human_detection" - - def visit( - self, - event_message: typing.Callable[[], T_Result], - event_action: typing.Callable[[], T_Result], - event_phone_call_connected: typing.Callable[[], T_Result], - event_phone_call_ended: typing.Callable[[], T_Result], - event_phone_call_did_not_connect: typing.Callable[[], T_Result], - event_transcript: typing.Callable[[], T_Result], - event_recording: typing.Callable[[], T_Result], - event_human_detection: typing.Callable[[], T_Result], - ) -> T_Result: - if self is EventType.EVENT_MESSAGE: - return event_message() - if self is EventType.EVENT_ACTION: - return event_action() - if self is EventType.EVENT_PHONE_CALL_CONNECTED: - return event_phone_call_connected() - if self is EventType.EVENT_PHONE_CALL_ENDED: - return event_phone_call_ended() - if self is EventType.EVENT_PHONE_CALL_DID_NOT_CONNECT: - return event_phone_call_did_not_connect() - if self is EventType.EVENT_TRANSCRIPT: - return event_transcript() - if self is EventType.EVENT_RECORDING: - return event_recording() - if self is EventType.EVENT_HUMAN_DETECTION: - return event_human_detection() +EventType = typing.Union[ + typing.Literal[ + "event_message", + "event_action", + "event_phone_call_connected", + "event_phone_call_ended", + "event_phone_call_did_not_connect", + "event_transcript", + "event_recording", + "event_human_detection", + ], + typing.Any, +] diff --git a/src/vocode/types/external_action.py b/src/vocode/types/external_action.py index eb3a8ec..29d720f 100644 --- a/src/vocode/types/external_action.py +++ b/src/vocode/types/external_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .external_action_action_trigger import ExternalActionActionTrigger from .external_action_config import ExternalActionConfig - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .function_call_action_trigger import FunctionCallActionTrigger +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class ExternalAction(pydantic.BaseModel): +class ExternalAction(UniversalBaseModel): id: str user_id: str + type: typing.Literal["action_external"] = "action_external" config: ExternalActionConfig - action_trigger: typing.Optional[ExternalActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + action_trigger: typing.Optional[FunctionCallActionTrigger] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/external_action_action_trigger.py b/src/vocode/types/external_action_action_trigger.py deleted file mode 100644 index 516bc48..0000000 --- a/src/vocode/types/external_action_action_trigger.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class ExternalActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ExternalActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -ExternalActionActionTrigger = typing.Union[ - ExternalActionActionTrigger_ActionTriggerFunctionCall, ExternalActionActionTrigger_ActionTriggerPhraseBased -] diff --git a/src/vocode/types/external_action_config.py b/src/vocode/types/external_action_config.py index 0501426..3627140 100644 --- a/src/vocode/types/external_action_config.py +++ b/src/vocode/types/external_action_config.py @@ -1,36 +1,26 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -import typing_extensions -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class ExternalActionConfig(pydantic.BaseModel): - processing_mode: typing.Optional[typing_extensions.Literal["muted"]] +class ExternalActionConfig(UniversalBaseModel): + processing_mode: typing.Optional[typing.Literal["muted"]] = None name: str description: str url: str - input_schema: typing.Dict[str, typing.Any] + input_schema: typing.Dict[str, typing.Optional[typing.Any]] speak_on_send: bool speak_on_receive: bool + signature_secret: typing.Optional[str] = None - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/external_action_params_action_trigger.py b/src/vocode/types/external_action_params_action_trigger.py deleted file mode 100644 index d72fd10..0000000 --- a/src/vocode/types/external_action_params_action_trigger.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class ExternalActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ExternalActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -ExternalActionParamsActionTrigger = typing.Union[ - ExternalActionParamsActionTrigger_ActionTriggerFunctionCall, - ExternalActionParamsActionTrigger_ActionTriggerPhraseBased, -] diff --git a/src/vocode/types/external_action_update_params_action_trigger.py b/src/vocode/types/external_action_update_params_action_trigger.py index 2be9974..895c34f 100644 --- a/src/vocode/types/external_action_update_params_action_trigger.py +++ b/src/vocode/types/external_action_update_params_action_trigger.py @@ -1,8 +1,7 @@ # This file was auto-generated by Fern from our API Definition. import typing - -from .external_action_update_params_action_trigger_zero import ExternalActionUpdateParamsActionTriggerZero +from .function_call_action_trigger import FunctionCallActionTrigger from .undefined import Undefined -ExternalActionUpdateParamsActionTrigger = typing.Union[ExternalActionUpdateParamsActionTriggerZero, Undefined] +ExternalActionUpdateParamsActionTrigger = typing.Union[FunctionCallActionTrigger, Undefined] diff --git a/src/vocode/types/external_action_update_params_action_trigger_zero.py b/src/vocode/types/external_action_update_params_action_trigger_zero.py deleted file mode 100644 index f776361..0000000 --- a/src/vocode/types/external_action_update_params_action_trigger_zero.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - -from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -ExternalActionUpdateParamsActionTriggerZero = typing.Union[ - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - ExternalActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -] diff --git a/src/vocode/types/external_action_update_params_config.py b/src/vocode/types/external_action_update_params_config.py index a9ccdb5..25e7dff 100644 --- a/src/vocode/types/external_action_update_params_config.py +++ b/src/vocode/types/external_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .external_action_config import ExternalActionConfig from .undefined import Undefined diff --git a/src/vocode/types/function_call_action_trigger.py b/src/vocode/types/function_call_action_trigger.py index cfea980..1ca265a 100644 --- a/src/vocode/types/function_call_action_trigger.py +++ b/src/vocode/types/function_call_action_trigger.py @@ -1,29 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .function_call_action_trigger_config import FunctionCallActionTriggerConfig +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class FunctionCallActionTrigger(pydantic.BaseModel): - config: typing.Optional[FunctionCallActionTriggerConfig] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class FunctionCallActionTrigger(UniversalBaseModel): + type: typing.Literal["action_trigger_function_call"] = "action_trigger_function_call" + config: typing.Optional[FunctionCallActionTriggerConfig] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/function_call_action_trigger_config.py b/src/vocode/types/function_call_action_trigger_config.py index c555c3a..957a51c 100644 --- a/src/vocode/types/function_call_action_trigger_config.py +++ b/src/vocode/types/function_call_action_trigger_config.py @@ -1,26 +1,17 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +class FunctionCallActionTriggerConfig(UniversalBaseModel): + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - -class FunctionCallActionTriggerConfig(pydantic.BaseModel): - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/http_method.py b/src/vocode/types/http_method.py index 174c3a0..1de6f4e 100644 --- a/src/vocode/types/http_method.py +++ b/src/vocode/types/http_method.py @@ -1,21 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class HttpMethod(str, enum.Enum): - """ - An enumeration. - """ - - GET = "GET" - POST = "POST" - - def visit(self, get: typing.Callable[[], T_Result], post: typing.Callable[[], T_Result]) -> T_Result: - if self is HttpMethod.GET: - return get() - if self is HttpMethod.POST: - return post() +HttpMethod = typing.Union[typing.Literal["GET", "POST"], typing.Any] diff --git a/src/vocode/types/http_validation_error.py b/src/vocode/types/http_validation_error.py index e5f647b..f52507f 100644 --- a/src/vocode/types/http_validation_error.py +++ b/src/vocode/types/http_validation_error.py @@ -1,29 +1,20 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .validation_error import ValidationError +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class HttpValidationError(pydantic.BaseModel): - detail: typing.Optional[typing.List[ValidationError]] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class HttpValidationError(UniversalBaseModel): + detail: typing.Optional[typing.List[ValidationError]] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/internal_llm_fallback.py b/src/vocode/types/internal_llm_fallback.py new file mode 100644 index 0000000..52565b5 --- /dev/null +++ b/src/vocode/types/internal_llm_fallback.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +from .internal_llm_fallback_provider import InternalLlmFallbackProvider +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import typing +import pydantic + + +class InternalLlmFallback(UniversalBaseModel): + provider: InternalLlmFallbackProvider + model_name: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/internal_llm_fallback_provider.py b/src/vocode/types/internal_llm_fallback_provider.py new file mode 100644 index 0000000..b0c8bcc --- /dev/null +++ b/src/vocode/types/internal_llm_fallback_provider.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InternalLlmFallbackProvider = typing.Union[typing.Literal["openai", "azure"], typing.Any] diff --git a/src/vocode/types/interrupt_sensitivity.py b/src/vocode/types/interrupt_sensitivity.py index dc3abe3..5aeaf80 100644 --- a/src/vocode/types/interrupt_sensitivity.py +++ b/src/vocode/types/interrupt_sensitivity.py @@ -1,21 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class InterruptSensitivity(str, enum.Enum): - """ - An enumeration. - """ - - LOW = "low" - HIGH = "high" - - def visit(self, low: typing.Callable[[], T_Result], high: typing.Callable[[], T_Result]) -> T_Result: - if self is InterruptSensitivity.LOW: - return low() - if self is InterruptSensitivity.HIGH: - return high() +InterruptSensitivity = typing.Union[typing.Literal["low", "high"], typing.Any] diff --git a/src/vocode/types/language.py b/src/vocode/types/language.py index 945b461..d0fdeef 100644 --- a/src/vocode/types/language.py +++ b/src/vocode/types/language.py @@ -1,61 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class Language(str, enum.Enum): - """ - An enumeration. - """ - - EN = "en" - ES = "es" - DE = "de" - HI = "hi" - PT = "pt" - FR = "fr" - NL = "nl" - ID = "id" - IT = "it" - JA = "ja" - KO = "ko" - - def visit( - self, - en: typing.Callable[[], T_Result], - es: typing.Callable[[], T_Result], - de: typing.Callable[[], T_Result], - hi: typing.Callable[[], T_Result], - pt: typing.Callable[[], T_Result], - fr: typing.Callable[[], T_Result], - nl: typing.Callable[[], T_Result], - id: typing.Callable[[], T_Result], - it: typing.Callable[[], T_Result], - ja: typing.Callable[[], T_Result], - ko: typing.Callable[[], T_Result], - ) -> T_Result: - if self is Language.EN: - return en() - if self is Language.ES: - return es() - if self is Language.DE: - return de() - if self is Language.HI: - return hi() - if self is Language.PT: - return pt() - if self is Language.FR: - return fr() - if self is Language.NL: - return nl() - if self is Language.ID: - return id() - if self is Language.IT: - return it() - if self is Language.JA: - return ja() - if self is Language.KO: - return ko() +Language = typing.Union[typing.Literal["en", "es", "de", "hi", "pt", "fr", "nl", "id", "it", "ja", "ko"], typing.Any] diff --git a/src/vocode/types/normalized_agent.py b/src/vocode/types/normalized_agent.py index 5c43873..37d58d0 100644 --- a/src/vocode/types/normalized_agent.py +++ b/src/vocode/types/normalized_agent.py @@ -1,56 +1,51 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .interrupt_sensitivity import InterruptSensitivity +from .normalized_agent_prompt import NormalizedAgentPrompt from .language import Language +from .normalized_agent_vector_database import NormalizedAgentVectorDatabase +from .interrupt_sensitivity import InterruptSensitivity from .normalized_agent_endpointing_sensitivity import NormalizedAgentEndpointingSensitivity from .normalized_agent_ivr_navigation_mode import NormalizedAgentIvrNavigationMode from .normalized_agent_openai_account_connection import NormalizedAgentOpenaiAccountConnection -from .normalized_agent_prompt import NormalizedAgentPrompt -from .normalized_agent_vector_database import NormalizedAgentVectorDatabase - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .internal_llm_fallback import InternalLlmFallback +from .normalized_agent_deepgram_keywords_value import NormalizedAgentDeepgramKeywordsValue +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class NormalizedAgent(pydantic.BaseModel): +class NormalizedAgent(UniversalBaseModel): id: str user_id: str - name: typing.Optional[str] + name: typing.Optional[str] = None prompt: NormalizedAgentPrompt - language: typing.Optional[Language] + language: typing.Optional[Language] = None actions: typing.List[str] voice: str - initial_message: typing.Optional[str] - webhook: typing.Optional[str] - vector_database: typing.Optional[NormalizedAgentVectorDatabase] - interrupt_sensitivity: typing.Optional[InterruptSensitivity] - context_endpoint: typing.Optional[str] - noise_suppression: typing.Optional[bool] - endpointing_sensitivity: typing.Optional[NormalizedAgentEndpointingSensitivity] - ivr_navigation_mode: typing.Optional[NormalizedAgentIvrNavigationMode] - conversation_speed: typing.Optional[float] - initial_message_delay: typing.Optional[float] - openai_model_name_override: typing.Optional[str] - ask_if_human_present_on_idle: typing.Optional[bool] - openai_account_connection: typing.Optional[NormalizedAgentOpenaiAccountConnection] - run_do_not_call_detection: typing.Optional[bool] - llm_temperature: typing.Optional[float] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + initial_message: typing.Optional[str] = None + webhook: typing.Optional[str] = None + vector_database: typing.Optional[NormalizedAgentVectorDatabase] = None + interrupt_sensitivity: typing.Optional[InterruptSensitivity] = None + context_endpoint: typing.Optional[str] = None + noise_suppression: typing.Optional[bool] = None + endpointing_sensitivity: typing.Optional[NormalizedAgentEndpointingSensitivity] = None + ivr_navigation_mode: typing.Optional[NormalizedAgentIvrNavigationMode] = None + conversation_speed: typing.Optional[float] = None + initial_message_delay: typing.Optional[float] = None + openai_model_name_override: typing.Optional[str] = None + ask_if_human_present_on_idle: typing.Optional[bool] = None + openai_account_connection: typing.Optional[NormalizedAgentOpenaiAccountConnection] = None + run_do_not_call_detection: typing.Optional[bool] = None + llm_fallback: typing.Optional[InternalLlmFallback] = None + deepgram_keywords: typing.Optional[typing.Dict[str, typing.Optional[NormalizedAgentDeepgramKeywordsValue]]] = None + llm_temperature: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/normalized_agent_deepgram_keywords_value.py b/src/vocode/types/normalized_agent_deepgram_keywords_value.py new file mode 100644 index 0000000..fab5773 --- /dev/null +++ b/src/vocode/types/normalized_agent_deepgram_keywords_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +NormalizedAgentDeepgramKeywordsValue = typing.Union[int, float] diff --git a/src/vocode/types/normalized_agent_endpointing_sensitivity.py b/src/vocode/types/normalized_agent_endpointing_sensitivity.py index b0939c4..32dfd8e 100644 --- a/src/vocode/types/normalized_agent_endpointing_sensitivity.py +++ b/src/vocode/types/normalized_agent_endpointing_sensitivity.py @@ -1,25 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedAgentEndpointingSensitivity(str, enum.Enum): - AUTO = "auto" - RELAXED = "relaxed" - SENSITIVE = "sensitive" - - def visit( - self, - auto: typing.Callable[[], T_Result], - relaxed: typing.Callable[[], T_Result], - sensitive: typing.Callable[[], T_Result], - ) -> T_Result: - if self is NormalizedAgentEndpointingSensitivity.AUTO: - return auto() - if self is NormalizedAgentEndpointingSensitivity.RELAXED: - return relaxed() - if self is NormalizedAgentEndpointingSensitivity.SENSITIVE: - return sensitive() +NormalizedAgentEndpointingSensitivity = typing.Union[typing.Literal["auto", "relaxed", "sensitive"], typing.Any] diff --git a/src/vocode/types/normalized_agent_ivr_navigation_mode.py b/src/vocode/types/normalized_agent_ivr_navigation_mode.py index 00fb6ad..056e241 100644 --- a/src/vocode/types/normalized_agent_ivr_navigation_mode.py +++ b/src/vocode/types/normalized_agent_ivr_navigation_mode.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedAgentIvrNavigationMode(str, enum.Enum): - DEFAULT = "default" - OFF = "off" - - def visit(self, default: typing.Callable[[], T_Result], off: typing.Callable[[], T_Result]) -> T_Result: - if self is NormalizedAgentIvrNavigationMode.DEFAULT: - return default() - if self is NormalizedAgentIvrNavigationMode.OFF: - return off() +NormalizedAgentIvrNavigationMode = typing.Union[typing.Literal["default", "off"], typing.Any] diff --git a/src/vocode/types/normalized_agent_openai_account_connection.py b/src/vocode/types/normalized_agent_openai_account_connection.py index 0f1836a..654bc07 100644 --- a/src/vocode/types/normalized_agent_openai_account_connection.py +++ b/src/vocode/types/normalized_agent_openai_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .open_ai_account_connection import OpenAiAccountConnection NormalizedAgentOpenaiAccountConnection = typing.Union[OpenAiAccountConnection, str] diff --git a/src/vocode/types/normalized_agent_prompt.py b/src/vocode/types/normalized_agent_prompt.py index beabf44..5670b55 100644 --- a/src/vocode/types/normalized_agent_prompt.py +++ b/src/vocode/types/normalized_agent_prompt.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .prompt_params import PromptParams NormalizedAgentPrompt = typing.Union[str, PromptParams] diff --git a/src/vocode/types/normalized_agent_vector_database.py b/src/vocode/types/normalized_agent_vector_database.py index cfe08bb..80194e1 100644 --- a/src/vocode/types/normalized_agent_vector_database.py +++ b/src/vocode/types/normalized_agent_vector_database.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .pinecone_vector_database_params import PineconeVectorDatabaseParams NormalizedAgentVectorDatabase = typing.Union[str, PineconeVectorDatabaseParams] diff --git a/src/vocode/types/normalized_call.py b/src/vocode/types/normalized_call.py index 55f74bd..f9c9cfb 100644 --- a/src/vocode/types/normalized_call.py +++ b/src/vocode/types/normalized_call.py @@ -1,60 +1,51 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .call_status import CallStatus from .normalized_call_human_detection_result import NormalizedCallHumanDetectionResult -from .normalized_call_on_no_human_answer import NormalizedCallOnNoHumanAnswer from .normalized_call_stage import NormalizedCallStage from .normalized_call_stage_outcome import NormalizedCallStageOutcome -from .normalized_call_telephony_account_connection import NormalizedCallTelephonyAccountConnection from .normalized_call_telephony_metadata import NormalizedCallTelephonyMetadata from .normalized_call_telephony_provider import NormalizedCallTelephonyProvider - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .normalized_call_on_no_human_answer import NormalizedCallOnNoHumanAnswer +from .normalized_call_telephony_account_connection import NormalizedCallTelephonyAccountConnection +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class NormalizedCall(pydantic.BaseModel): +class NormalizedCall(UniversalBaseModel): id: str user_id: str - status: typing.Optional[CallStatus] - error_message: typing.Optional[str] - recording_available: typing.Optional[bool] - transcript: typing.Optional[str] - human_detection_result: typing.Optional[NormalizedCallHumanDetectionResult] - do_not_call_result: typing.Optional[bool] - telephony_id: typing.Optional[str] - stage: typing.Optional[NormalizedCallStage] - stage_outcome: typing.Optional[NormalizedCallStageOutcome] - telephony_metadata: typing.Optional[NormalizedCallTelephonyMetadata] + status: typing.Optional[CallStatus] = None + error_message: typing.Optional[str] = None + recording_available: typing.Optional[bool] = None + transcript: typing.Optional[str] = None + human_detection_result: typing.Optional[NormalizedCallHumanDetectionResult] = None + do_not_call_result: typing.Optional[bool] = None + telephony_id: typing.Optional[str] = None + stage: typing.Optional[NormalizedCallStage] = None + stage_outcome: typing.Optional[NormalizedCallStageOutcome] = None + telephony_metadata: typing.Optional[NormalizedCallTelephonyMetadata] = None + start_time: typing.Optional[float] = None + end_time: typing.Optional[float] = None to_number: str from_number: str agent: str telephony_provider: NormalizedCallTelephonyProvider agent_phone_number: str - start_time: typing.Optional[dt.datetime] - end_time: typing.Optional[dt.datetime] - hipaa_compliant: typing.Optional[bool] - on_no_human_answer: typing.Optional[NormalizedCallOnNoHumanAnswer] - context: typing.Optional[typing.Dict[str, str]] - run_do_not_call_detection: typing.Optional[bool] - telephony_account_connection: typing.Optional[NormalizedCallTelephonyAccountConnection] - telephony_params: typing.Optional[typing.Dict[str, str]] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + hipaa_compliant: typing.Optional[bool] = None + on_no_human_answer: typing.Optional[NormalizedCallOnNoHumanAnswer] = None + context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + run_do_not_call_detection: typing.Optional[bool] = None + telephony_account_connection: typing.Optional[NormalizedCallTelephonyAccountConnection] = None + telephony_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/normalized_call_human_detection_result.py b/src/vocode/types/normalized_call_human_detection_result.py index 6e3051d..b14ecc7 100644 --- a/src/vocode/types/normalized_call_human_detection_result.py +++ b/src/vocode/types/normalized_call_human_detection_result.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedCallHumanDetectionResult(str, enum.Enum): - HUMAN = "human" - NO_HUMAN = "no_human" - - def visit(self, human: typing.Callable[[], T_Result], no_human: typing.Callable[[], T_Result]) -> T_Result: - if self is NormalizedCallHumanDetectionResult.HUMAN: - return human() - if self is NormalizedCallHumanDetectionResult.NO_HUMAN: - return no_human() +NormalizedCallHumanDetectionResult = typing.Union[typing.Literal["human", "no_human"], typing.Any] diff --git a/src/vocode/types/normalized_call_on_no_human_answer.py b/src/vocode/types/normalized_call_on_no_human_answer.py index a12dc9a..d363cc8 100644 --- a/src/vocode/types/normalized_call_on_no_human_answer.py +++ b/src/vocode/types/normalized_call_on_no_human_answer.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedCallOnNoHumanAnswer(str, enum.Enum): - CONTINUE = "continue" - HANGUP = "hangup" - - def visit(self, continue_: typing.Callable[[], T_Result], hangup: typing.Callable[[], T_Result]) -> T_Result: - if self is NormalizedCallOnNoHumanAnswer.CONTINUE: - return continue_() - if self is NormalizedCallOnNoHumanAnswer.HANGUP: - return hangup() +NormalizedCallOnNoHumanAnswer = typing.Union[typing.Literal["continue", "hangup"], typing.Any] diff --git a/src/vocode/types/normalized_call_stage.py b/src/vocode/types/normalized_call_stage.py index 932da9e..8e1700e 100644 --- a/src/vocode/types/normalized_call_stage.py +++ b/src/vocode/types/normalized_call_stage.py @@ -1,29 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedCallStage(str, enum.Enum): - CREATED = "created" - PICKED_UP = "picked_up" - TRANSFER_STARTED = "transfer_started" - TRANSFER_SUCCESSFUL = "transfer_successful" - - def visit( - self, - created: typing.Callable[[], T_Result], - picked_up: typing.Callable[[], T_Result], - transfer_started: typing.Callable[[], T_Result], - transfer_successful: typing.Callable[[], T_Result], - ) -> T_Result: - if self is NormalizedCallStage.CREATED: - return created() - if self is NormalizedCallStage.PICKED_UP: - return picked_up() - if self is NormalizedCallStage.TRANSFER_STARTED: - return transfer_started() - if self is NormalizedCallStage.TRANSFER_SUCCESSFUL: - return transfer_successful() +NormalizedCallStage = typing.Union[ + typing.Literal["created", "picked_up", "transfer_started", "transfer_successful"], typing.Any +] diff --git a/src/vocode/types/normalized_call_stage_outcome.py b/src/vocode/types/normalized_call_stage_outcome.py index c3395cc..fa9db6e 100644 --- a/src/vocode/types/normalized_call_stage_outcome.py +++ b/src/vocode/types/normalized_call_stage_outcome.py @@ -1,37 +1,15 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedCallStageOutcome(str, enum.Enum): - HUMAN_UNANSWERED = "human_unanswered" - CALL_DID_NOT_CONNECT = "call_did_not_connect" - HUMAN_DISCONNECTED = "human_disconnected" - BOT_DISCONNECTED = "bot_disconnected" - TRANSFER_UNANSWERED = "transfer_unanswered" - TRANSFER_DISCONNECTED = "transfer_disconnected" - - def visit( - self, - human_unanswered: typing.Callable[[], T_Result], - call_did_not_connect: typing.Callable[[], T_Result], - human_disconnected: typing.Callable[[], T_Result], - bot_disconnected: typing.Callable[[], T_Result], - transfer_unanswered: typing.Callable[[], T_Result], - transfer_disconnected: typing.Callable[[], T_Result], - ) -> T_Result: - if self is NormalizedCallStageOutcome.HUMAN_UNANSWERED: - return human_unanswered() - if self is NormalizedCallStageOutcome.CALL_DID_NOT_CONNECT: - return call_did_not_connect() - if self is NormalizedCallStageOutcome.HUMAN_DISCONNECTED: - return human_disconnected() - if self is NormalizedCallStageOutcome.BOT_DISCONNECTED: - return bot_disconnected() - if self is NormalizedCallStageOutcome.TRANSFER_UNANSWERED: - return transfer_unanswered() - if self is NormalizedCallStageOutcome.TRANSFER_DISCONNECTED: - return transfer_disconnected() +NormalizedCallStageOutcome = typing.Union[ + typing.Literal[ + "human_unanswered", + "call_did_not_connect", + "human_disconnected", + "bot_disconnected", + "transfer_unanswered", + "transfer_disconnected", + ], + typing.Any, +] diff --git a/src/vocode/types/normalized_call_telephony_account_connection.py b/src/vocode/types/normalized_call_telephony_account_connection.py index 3a3a514..c873c45 100644 --- a/src/vocode/types/normalized_call_telephony_account_connection.py +++ b/src/vocode/types/normalized_call_telephony_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .twilio_account_connection import TwilioAccountConnection NormalizedCallTelephonyAccountConnection = typing.Union[str, TwilioAccountConnection] diff --git a/src/vocode/types/normalized_call_telephony_metadata.py b/src/vocode/types/normalized_call_telephony_metadata.py index c0b979f..0aa0eeb 100644 --- a/src/vocode/types/normalized_call_telephony_metadata.py +++ b/src/vocode/types/normalized_call_telephony_metadata.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .twilio_telephony_metadata import TwilioTelephonyMetadata from .vonage_telephony_metadata import VonageTelephonyMetadata - -class NormalizedCallTelephonyMetadata_TelephonyMetadataVonage(VonageTelephonyMetadata): - type: typing_extensions.Literal["telephony_metadata_vonage"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio(TwilioTelephonyMetadata): - type: typing_extensions.Literal["telephony_metadata_twilio"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -NormalizedCallTelephonyMetadata = typing.Union[ - NormalizedCallTelephonyMetadata_TelephonyMetadataVonage, NormalizedCallTelephonyMetadata_TelephonyMetadataTwilio -] +NormalizedCallTelephonyMetadata = typing.Union[TwilioTelephonyMetadata, VonageTelephonyMetadata] diff --git a/src/vocode/types/normalized_call_telephony_provider.py b/src/vocode/types/normalized_call_telephony_provider.py index c55c222..fd38283 100644 --- a/src/vocode/types/normalized_call_telephony_provider.py +++ b/src/vocode/types/normalized_call_telephony_provider.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedCallTelephonyProvider(str, enum.Enum): - VONAGE = "vonage" - TWILIO = "twilio" - - def visit(self, vonage: typing.Callable[[], T_Result], twilio: typing.Callable[[], T_Result]) -> T_Result: - if self is NormalizedCallTelephonyProvider.VONAGE: - return vonage() - if self is NormalizedCallTelephonyProvider.TWILIO: - return twilio() +NormalizedCallTelephonyProvider = typing.Union[typing.Literal["vonage", "twilio"], typing.Any] diff --git a/src/vocode/types/normalized_phone_number.py b/src/vocode/types/normalized_phone_number.py index 1fd4639..720c8cc 100644 --- a/src/vocode/types/normalized_phone_number.py +++ b/src/vocode/types/normalized_phone_number.py @@ -1,39 +1,30 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .normalized_phone_number_telephony_account_connection import NormalizedPhoneNumberTelephonyAccountConnection from .normalized_phone_number_telephony_provider import NormalizedPhoneNumberTelephonyProvider - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .normalized_phone_number_telephony_account_connection import NormalizedPhoneNumberTelephonyAccountConnection +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class NormalizedPhoneNumber(pydantic.BaseModel): +class NormalizedPhoneNumber(UniversalBaseModel): id: str user_id: str - active: typing.Optional[bool] - label: typing.Optional[str] - inbound_agent: str - outbound_only: typing.Optional[bool] - example_context: typing.Optional[typing.Dict[str, str]] + active: typing.Optional[bool] = None + label: typing.Optional[str] = None + inbound_agent: typing.Optional[str] = None + outbound_only: typing.Optional[bool] = None + example_context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None number: str - telephony_provider: typing.Optional[NormalizedPhoneNumberTelephonyProvider] - telephony_account_connection: typing.Optional[NormalizedPhoneNumberTelephonyAccountConnection] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + telephony_provider: typing.Optional[NormalizedPhoneNumberTelephonyProvider] = None + telephony_account_connection: typing.Optional[NormalizedPhoneNumberTelephonyAccountConnection] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/normalized_phone_number_telephony_account_connection.py b/src/vocode/types/normalized_phone_number_telephony_account_connection.py index b0a4e9f..738e326 100644 --- a/src/vocode/types/normalized_phone_number_telephony_account_connection.py +++ b/src/vocode/types/normalized_phone_number_telephony_account_connection.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .twilio_account_connection import TwilioAccountConnection NormalizedPhoneNumberTelephonyAccountConnection = typing.Union[str, TwilioAccountConnection] diff --git a/src/vocode/types/normalized_phone_number_telephony_provider.py b/src/vocode/types/normalized_phone_number_telephony_provider.py index 5ad1ddc..f8be286 100644 --- a/src/vocode/types/normalized_phone_number_telephony_provider.py +++ b/src/vocode/types/normalized_phone_number_telephony_provider.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class NormalizedPhoneNumberTelephonyProvider(str, enum.Enum): - VONAGE = "vonage" - TWILIO = "twilio" - - def visit(self, vonage: typing.Callable[[], T_Result], twilio: typing.Callable[[], T_Result]) -> T_Result: - if self is NormalizedPhoneNumberTelephonyProvider.VONAGE: - return vonage() - if self is NormalizedPhoneNumberTelephonyProvider.TWILIO: - return twilio() +NormalizedPhoneNumberTelephonyProvider = typing.Union[typing.Literal["vonage", "twilio"], typing.Any] diff --git a/src/vocode/types/normalized_prompt.py b/src/vocode/types/normalized_prompt.py index c1b1d3e..7397948 100644 --- a/src/vocode/types/normalized_prompt.py +++ b/src/vocode/types/normalized_prompt.py @@ -1,34 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .collect_field import CollectField - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class NormalizedPrompt(pydantic.BaseModel): +class NormalizedPrompt(UniversalBaseModel): id: str user_id: str - content: typing.Optional[str] - collect_fields: typing.Optional[typing.List[CollectField]] - context_endpoint: typing.Optional[str] - prompt_template: typing.Optional[str] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + content: typing.Optional[str] = None + collect_fields: typing.Optional[typing.List[CollectField]] = None + context_endpoint: typing.Optional[str] = None + prompt_template: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/open_ai_account_connection.py b/src/vocode/types/open_ai_account_connection.py index 3575837..c60146e 100644 --- a/src/vocode/types/open_ai_account_connection.py +++ b/src/vocode/types/open_ai_account_connection.py @@ -1,31 +1,23 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import UniversalBaseModel from .open_ai_credentials import OpenAiCredentials - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class OpenAiAccountConnection(pydantic.BaseModel): +class OpenAiAccountConnection(UniversalBaseModel): id: str user_id: str credentials: OpenAiCredentials + type: typing.Literal["account_connection_openai"] = "account_connection_openai" - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/open_ai_account_connection_params.py b/src/vocode/types/open_ai_account_connection_params.py index c322e4d..1aad9c6 100644 --- a/src/vocode/types/open_ai_account_connection_params.py +++ b/src/vocode/types/open_ai_account_connection_params.py @@ -1,29 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import UniversalBaseModel from .open_ai_credentials import OpenAiCredentials - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class OpenAiAccountConnectionParams(pydantic.BaseModel): +class OpenAiAccountConnectionParams(UniversalBaseModel): credentials: OpenAiCredentials + type: typing.Literal["account_connection_openai"] = "account_connection_openai" - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/open_ai_account_connection_update_params.py b/src/vocode/types/open_ai_account_connection_update_params.py index 1d761a8..d7127c4 100644 --- a/src/vocode/types/open_ai_account_connection_update_params.py +++ b/src/vocode/types/open_ai_account_connection_update_params.py @@ -1,29 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .open_ai_account_connection_update_params_credentials import OpenAiAccountConnectionUpdateParamsCredentials +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class OpenAiAccountConnectionUpdateParams(pydantic.BaseModel): - credentials: typing.Optional[OpenAiAccountConnectionUpdateParamsCredentials] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class OpenAiAccountConnectionUpdateParams(UniversalBaseModel): + credentials: typing.Optional[OpenAiAccountConnectionUpdateParamsCredentials] = None + type: typing.Literal["account_connection_openai"] = "account_connection_openai" - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/open_ai_account_connection_update_params_credentials.py b/src/vocode/types/open_ai_account_connection_update_params_credentials.py index 7750ae1..7cbb350 100644 --- a/src/vocode/types/open_ai_account_connection_update_params_credentials.py +++ b/src/vocode/types/open_ai_account_connection_update_params_credentials.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .open_ai_credentials import OpenAiCredentials from .undefined import Undefined diff --git a/src/vocode/types/open_ai_credentials.py b/src/vocode/types/open_ai_credentials.py index 7dfb113..b1061ba 100644 --- a/src/vocode/types/open_ai_credentials.py +++ b/src/vocode/types/open_ai_credentials.py @@ -1,28 +1,19 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class OpenAiCredentials(pydantic.BaseModel): +class OpenAiCredentials(UniversalBaseModel): openai_api_key: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phone_number.py b/src/vocode/types/phone_number.py index a00bb98..38a55c4 100644 --- a/src/vocode/types/phone_number.py +++ b/src/vocode/types/phone_number.py @@ -1,40 +1,31 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .agent import Agent from .phone_number_telephony_provider import PhoneNumberTelephonyProvider from .twilio_account_connection import TwilioAccountConnection - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class PhoneNumber(pydantic.BaseModel): +class PhoneNumber(UniversalBaseModel): id: str user_id: str - active: typing.Optional[bool] - label: typing.Optional[str] - inbound_agent: Agent - outbound_only: typing.Optional[bool] - example_context: typing.Optional[typing.Dict[str, str]] + active: typing.Optional[bool] = None + label: typing.Optional[str] = None + inbound_agent: typing.Optional[Agent] = None + outbound_only: typing.Optional[bool] = None + example_context: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None number: str - telephony_provider: typing.Optional[PhoneNumberTelephonyProvider] - telephony_account_connection: typing.Optional[TwilioAccountConnection] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + telephony_provider: typing.Optional[PhoneNumberTelephonyProvider] = None + telephony_account_connection: typing.Optional[TwilioAccountConnection] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phone_number_page.py b/src/vocode/types/phone_number_page.py index 97b1150..bab6d3c 100644 --- a/src/vocode/types/phone_number_page.py +++ b/src/vocode/types/phone_number_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .normalized_phone_number import NormalizedPhoneNumber - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class PhoneNumberPage(pydantic.BaseModel): +class PhoneNumberPage(UniversalBaseModel): items: typing.List[NormalizedPhoneNumber] page: int size: int @@ -20,15 +15,11 @@ class PhoneNumberPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phone_number_telephony_provider.py b/src/vocode/types/phone_number_telephony_provider.py index db52ac5..c40131d 100644 --- a/src/vocode/types/phone_number_telephony_provider.py +++ b/src/vocode/types/phone_number_telephony_provider.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PhoneNumberTelephonyProvider(str, enum.Enum): - VONAGE = "vonage" - TWILIO = "twilio" - - def visit(self, vonage: typing.Callable[[], T_Result], twilio: typing.Callable[[], T_Result]) -> T_Result: - if self is PhoneNumberTelephonyProvider.VONAGE: - return vonage() - if self is PhoneNumberTelephonyProvider.TWILIO: - return twilio() +PhoneNumberTelephonyProvider = typing.Union[typing.Literal["vonage", "twilio"], typing.Any] diff --git a/src/vocode/types/phrase_based_action_trigger.py b/src/vocode/types/phrase_based_action_trigger.py deleted file mode 100644 index fb4f396..0000000 --- a/src/vocode/types/phrase_based_action_trigger.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime -from .phrase_based_action_trigger_config import PhraseBasedActionTriggerConfig - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PhraseBasedActionTrigger(pydantic.BaseModel): - config: PhraseBasedActionTriggerConfig - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/vocode/types/phrase_based_action_trigger_config.py b/src/vocode/types/phrase_based_action_trigger_config.py index bc32b23..2dfb79f 100644 --- a/src/vocode/types/phrase_based_action_trigger_config.py +++ b/src/vocode/types/phrase_based_action_trigger_config.py @@ -1,29 +1,20 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .phrase_trigger import PhraseTrigger - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class PhraseBasedActionTriggerConfig(pydantic.BaseModel): +class PhraseBasedActionTriggerConfig(UniversalBaseModel): phrase_triggers: typing.List[PhraseTrigger] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phrase_based_action_trigger_input.py b/src/vocode/types/phrase_based_action_trigger_input.py new file mode 100644 index 0000000..0f8dc44 --- /dev/null +++ b/src/vocode/types/phrase_based_action_trigger_input.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from .phrase_based_action_trigger_config import PhraseBasedActionTriggerConfig +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class PhraseBasedActionTriggerInput(UniversalBaseModel): + type: typing.Literal["action_trigger_phrase_based"] = "action_trigger_phrase_based" + config: PhraseBasedActionTriggerConfig + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phrase_based_action_trigger_output.py b/src/vocode/types/phrase_based_action_trigger_output.py new file mode 100644 index 0000000..8850e1b --- /dev/null +++ b/src/vocode/types/phrase_based_action_trigger_output.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from .phrase_based_action_trigger_config import PhraseBasedActionTriggerConfig +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class PhraseBasedActionTriggerOutput(UniversalBaseModel): + type: typing.Literal["action_trigger_phrase_based"] = "action_trigger_phrase_based" + config: PhraseBasedActionTriggerConfig + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/phrase_trigger.py b/src/vocode/types/phrase_trigger.py index 4c72166..cdbe5d7 100644 --- a/src/vocode/types/phrase_trigger.py +++ b/src/vocode/types/phrase_trigger.py @@ -1,31 +1,20 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -import typing_extensions -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PhraseTrigger(pydantic.BaseModel): +class PhraseTrigger(UniversalBaseModel): phrase: str - conditions: typing.List[typing_extensions.Literal["phrase_condition_type_contains"]] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + conditions: typing.List[typing.Literal["phrase_condition_type_contains"]] - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/pinecone_vector_database.py b/src/vocode/types/pinecone_vector_database.py index 6a010f3..881226a 100644 --- a/src/vocode/types/pinecone_vector_database.py +++ b/src/vocode/types/pinecone_vector_database.py @@ -1,35 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -import typing_extensions -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PineconeVectorDatabase(pydantic.BaseModel): +class PineconeVectorDatabase(UniversalBaseModel): id: str user_id: str - type: typing_extensions.Literal["vector_database_pinecone"] + type: typing.Literal["vector_database_pinecone"] = "vector_database_pinecone" index: str api_key: str api_environment: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/pinecone_vector_database_params.py b/src/vocode/types/pinecone_vector_database_params.py index 5aec910..c605591 100644 --- a/src/vocode/types/pinecone_vector_database_params.py +++ b/src/vocode/types/pinecone_vector_database_params.py @@ -1,33 +1,22 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -import typing_extensions -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PineconeVectorDatabaseParams(pydantic.BaseModel): - type: typing_extensions.Literal["vector_database_pinecone"] +class PineconeVectorDatabaseParams(UniversalBaseModel): + type: typing.Literal["vector_database_pinecone"] = "vector_database_pinecone" index: str api_key: str api_environment: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/pinecone_vector_database_update_params.py b/src/vocode/types/pinecone_vector_database_update_params.py index f95b66b..a9f55e1 100644 --- a/src/vocode/types/pinecone_vector_database_update_params.py +++ b/src/vocode/types/pinecone_vector_database_update_params.py @@ -1,36 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -import typing_extensions - -from ..core.datetime_utils import serialize_datetime -from .pinecone_vector_database_update_params_api_environment import PineconeVectorDatabaseUpdateParamsApiEnvironment -from .pinecone_vector_database_update_params_api_key import PineconeVectorDatabaseUpdateParamsApiKey from .pinecone_vector_database_update_params_index import PineconeVectorDatabaseUpdateParamsIndex +from .pinecone_vector_database_update_params_api_key import PineconeVectorDatabaseUpdateParamsApiKey +from .pinecone_vector_database_update_params_api_environment import PineconeVectorDatabaseUpdateParamsApiEnvironment +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PineconeVectorDatabaseUpdateParams(pydantic.BaseModel): - type: typing_extensions.Literal["vector_database_pinecone"] - index: typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] - api_key: typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] - api_environment: typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class PineconeVectorDatabaseUpdateParams(UniversalBaseModel): + type: typing.Literal["vector_database_pinecone"] = "vector_database_pinecone" + index: typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] = None + api_key: typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] = None + api_environment: typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/pinecone_vector_database_update_params_api_environment.py b/src/vocode/types/pinecone_vector_database_update_params_api_environment.py index 3855f67..4d000ed 100644 --- a/src/vocode/types/pinecone_vector_database_update_params_api_environment.py +++ b/src/vocode/types/pinecone_vector_database_update_params_api_environment.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PineconeVectorDatabaseUpdateParamsApiEnvironment = typing.Union[str, Undefined] diff --git a/src/vocode/types/pinecone_vector_database_update_params_api_key.py b/src/vocode/types/pinecone_vector_database_update_params_api_key.py index 804ae56..c7a0937 100644 --- a/src/vocode/types/pinecone_vector_database_update_params_api_key.py +++ b/src/vocode/types/pinecone_vector_database_update_params_api_key.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PineconeVectorDatabaseUpdateParamsApiKey = typing.Union[str, Undefined] diff --git a/src/vocode/types/pinecone_vector_database_update_params_index.py b/src/vocode/types/pinecone_vector_database_update_params_index.py index e8ac973..b10817a 100644 --- a/src/vocode/types/pinecone_vector_database_update_params_index.py +++ b/src/vocode/types/pinecone_vector_database_update_params_index.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PineconeVectorDatabaseUpdateParamsIndex = typing.Union[str, Undefined] diff --git a/src/vocode/types/plan_type.py b/src/vocode/types/plan_type.py index 135a06b..f757f4b 100644 --- a/src/vocode/types/plan_type.py +++ b/src/vocode/types/plan_type.py @@ -1,33 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PlanType(str, enum.Enum): - """ - An enumeration. - """ - - PLAN_FREE = "plan_free" - PLAN_DEVELOPER = "plan_developer" - PLAN_ENTERPRISE = "plan_enterprise" - PLAN_UNLIMITED = "plan_unlimited" - - def visit( - self, - plan_free: typing.Callable[[], T_Result], - plan_developer: typing.Callable[[], T_Result], - plan_enterprise: typing.Callable[[], T_Result], - plan_unlimited: typing.Callable[[], T_Result], - ) -> T_Result: - if self is PlanType.PLAN_FREE: - return plan_free() - if self is PlanType.PLAN_DEVELOPER: - return plan_developer() - if self is PlanType.PLAN_ENTERPRISE: - return plan_enterprise() - if self is PlanType.PLAN_UNLIMITED: - return plan_unlimited() +PlanType = typing.Union[typing.Literal["plan_free", "plan_developer", "plan_enterprise", "plan_unlimited"], typing.Any] diff --git a/src/vocode/types/play_ht_voice.py b/src/vocode/types/play_ht_voice.py index 33f9c19..bfc6872 100644 --- a/src/vocode/types/play_ht_voice.py +++ b/src/vocode/types/play_ht_voice.py @@ -1,42 +1,34 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .play_ht_voice_quality import PlayHtVoiceQuality from .play_ht_voice_version import PlayHtVoiceVersion - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .play_ht_voice_quality import PlayHtVoiceQuality +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class PlayHtVoice(pydantic.BaseModel): +class PlayHtVoice(UniversalBaseModel): id: str user_id: str + type: typing.Literal["voice_play_ht"] = "voice_play_ht" voice_id: str - api_user_id: typing.Optional[str] - api_key: typing.Optional[str] - version: typing.Optional[PlayHtVoiceVersion] - speed: typing.Optional[float] - quality: typing.Optional[PlayHtVoiceQuality] - temperature: typing.Optional[float] - top_p: typing.Optional[float] - text_guidance: typing.Optional[float] - voice_guidance: typing.Optional[float] - experimental_remove_silence: typing.Optional[bool] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + api_user_id: typing.Optional[str] = None + api_key: typing.Optional[str] = None + version: typing.Optional[PlayHtVoiceVersion] = None + speed: typing.Optional[float] = None + quality: typing.Optional[PlayHtVoiceQuality] = None + temperature: typing.Optional[float] = None + top_p: typing.Optional[float] = None + text_guidance: typing.Optional[float] = None + voice_guidance: typing.Optional[float] = None + experimental_remove_silence: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/play_ht_voice_params_quality.py b/src/vocode/types/play_ht_voice_params_quality.py index 91692fc..51c41c0 100644 --- a/src/vocode/types/play_ht_voice_params_quality.py +++ b/src/vocode/types/play_ht_voice_params_quality.py @@ -1,37 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PlayHtVoiceParamsQuality(str, enum.Enum): - FASTER = "faster" - DRAFT = "draft" - LOW = "low" - MEDIUM = "medium" - HIGH = "high" - PREMIUM = "premium" - - def visit( - self, - faster: typing.Callable[[], T_Result], - draft: typing.Callable[[], T_Result], - low: typing.Callable[[], T_Result], - medium: typing.Callable[[], T_Result], - high: typing.Callable[[], T_Result], - premium: typing.Callable[[], T_Result], - ) -> T_Result: - if self is PlayHtVoiceParamsQuality.FASTER: - return faster() - if self is PlayHtVoiceParamsQuality.DRAFT: - return draft() - if self is PlayHtVoiceParamsQuality.LOW: - return low() - if self is PlayHtVoiceParamsQuality.MEDIUM: - return medium() - if self is PlayHtVoiceParamsQuality.HIGH: - return high() - if self is PlayHtVoiceParamsQuality.PREMIUM: - return premium() +PlayHtVoiceParamsQuality = typing.Union[ + typing.Literal["faster", "draft", "low", "medium", "high", "premium"], typing.Any +] diff --git a/src/vocode/types/play_ht_voice_params_version.py b/src/vocode/types/play_ht_voice_params_version.py index 112f805..c0bf4a9 100644 --- a/src/vocode/types/play_ht_voice_params_version.py +++ b/src/vocode/types/play_ht_voice_params_version.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PlayHtVoiceParamsVersion(str, enum.Enum): - ONE = "1" - TWO = "2" - - def visit(self, one: typing.Callable[[], T_Result], two: typing.Callable[[], T_Result]) -> T_Result: - if self is PlayHtVoiceParamsVersion.ONE: - return one() - if self is PlayHtVoiceParamsVersion.TWO: - return two() +PlayHtVoiceParamsVersion = typing.Union[typing.Literal["1", "2"], typing.Any] diff --git a/src/vocode/types/play_ht_voice_quality.py b/src/vocode/types/play_ht_voice_quality.py index ef5384e..8e2faf6 100644 --- a/src/vocode/types/play_ht_voice_quality.py +++ b/src/vocode/types/play_ht_voice_quality.py @@ -1,37 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PlayHtVoiceQuality(str, enum.Enum): - FASTER = "faster" - DRAFT = "draft" - LOW = "low" - MEDIUM = "medium" - HIGH = "high" - PREMIUM = "premium" - - def visit( - self, - faster: typing.Callable[[], T_Result], - draft: typing.Callable[[], T_Result], - low: typing.Callable[[], T_Result], - medium: typing.Callable[[], T_Result], - high: typing.Callable[[], T_Result], - premium: typing.Callable[[], T_Result], - ) -> T_Result: - if self is PlayHtVoiceQuality.FASTER: - return faster() - if self is PlayHtVoiceQuality.DRAFT: - return draft() - if self is PlayHtVoiceQuality.LOW: - return low() - if self is PlayHtVoiceQuality.MEDIUM: - return medium() - if self is PlayHtVoiceQuality.HIGH: - return high() - if self is PlayHtVoiceQuality.PREMIUM: - return premium() +PlayHtVoiceQuality = typing.Union[typing.Literal["faster", "draft", "low", "medium", "high", "premium"], typing.Any] diff --git a/src/vocode/types/play_ht_voice_update_params_api_key.py b/src/vocode/types/play_ht_voice_update_params_api_key.py index 79ce72b..c064282 100644 --- a/src/vocode/types/play_ht_voice_update_params_api_key.py +++ b/src/vocode/types/play_ht_voice_update_params_api_key.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsApiKey = typing.Union[str, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_api_user_id.py b/src/vocode/types/play_ht_voice_update_params_api_user_id.py index 6017cf5..83a41c8 100644 --- a/src/vocode/types/play_ht_voice_update_params_api_user_id.py +++ b/src/vocode/types/play_ht_voice_update_params_api_user_id.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsApiUserId = typing.Union[str, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_experimental_remove_silence.py b/src/vocode/types/play_ht_voice_update_params_experimental_remove_silence.py index f4747ee..eac583d 100644 --- a/src/vocode/types/play_ht_voice_update_params_experimental_remove_silence.py +++ b/src/vocode/types/play_ht_voice_update_params_experimental_remove_silence.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsExperimentalRemoveSilence = typing.Union[bool, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_quality.py b/src/vocode/types/play_ht_voice_update_params_quality.py index 83e619f..eb8b747 100644 --- a/src/vocode/types/play_ht_voice_update_params_quality.py +++ b/src/vocode/types/play_ht_voice_update_params_quality.py @@ -1,17 +1,14 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined PlayHtVoiceUpdateParamsQuality = typing.Union[ - typing_extensions.Literal["faster"], - typing_extensions.Literal["draft"], - typing_extensions.Literal["low"], - typing_extensions.Literal["medium"], - typing_extensions.Literal["high"], - typing_extensions.Literal["premium"], + typing.Literal["faster"], + typing.Literal["draft"], + typing.Literal["low"], + typing.Literal["medium"], + typing.Literal["high"], + typing.Literal["premium"], Undefined, ] diff --git a/src/vocode/types/play_ht_voice_update_params_speed.py b/src/vocode/types/play_ht_voice_update_params_speed.py index fd49427..ee15f1a 100644 --- a/src/vocode/types/play_ht_voice_update_params_speed.py +++ b/src/vocode/types/play_ht_voice_update_params_speed.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsSpeed = typing.Union[float, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_temperature.py b/src/vocode/types/play_ht_voice_update_params_temperature.py index e6d0199..cb4cc4f 100644 --- a/src/vocode/types/play_ht_voice_update_params_temperature.py +++ b/src/vocode/types/play_ht_voice_update_params_temperature.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsTemperature = typing.Union[float, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_text_guidance.py b/src/vocode/types/play_ht_voice_update_params_text_guidance.py index bc5cf27..94558de 100644 --- a/src/vocode/types/play_ht_voice_update_params_text_guidance.py +++ b/src/vocode/types/play_ht_voice_update_params_text_guidance.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsTextGuidance = typing.Union[float, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_top_p.py b/src/vocode/types/play_ht_voice_update_params_top_p.py index cc356a6..c0a91a5 100644 --- a/src/vocode/types/play_ht_voice_update_params_top_p.py +++ b/src/vocode/types/play_ht_voice_update_params_top_p.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsTopP = typing.Union[float, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_version.py b/src/vocode/types/play_ht_voice_update_params_version.py index 66e2eee..4e69c7d 100644 --- a/src/vocode/types/play_ht_voice_update_params_version.py +++ b/src/vocode/types/play_ht_voice_update_params_version.py @@ -1,9 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined -PlayHtVoiceUpdateParamsVersion = typing.Union[typing_extensions.Literal["1"], typing_extensions.Literal["2"], Undefined] +PlayHtVoiceUpdateParamsVersion = typing.Union[typing.Literal["1"], typing.Literal["2"], Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_voice_guidance.py b/src/vocode/types/play_ht_voice_update_params_voice_guidance.py index 37277c8..e5abd25 100644 --- a/src/vocode/types/play_ht_voice_update_params_voice_guidance.py +++ b/src/vocode/types/play_ht_voice_update_params_voice_guidance.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsVoiceGuidance = typing.Union[float, Undefined] diff --git a/src/vocode/types/play_ht_voice_update_params_voice_id.py b/src/vocode/types/play_ht_voice_update_params_voice_id.py index 20fa8b2..18a2521 100644 --- a/src/vocode/types/play_ht_voice_update_params_voice_id.py +++ b/src/vocode/types/play_ht_voice_update_params_voice_id.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PlayHtVoiceUpdateParamsVoiceId = typing.Union[str, Undefined] diff --git a/src/vocode/types/play_ht_voice_version.py b/src/vocode/types/play_ht_voice_version.py index 6e9ca23..b6a6b58 100644 --- a/src/vocode/types/play_ht_voice_version.py +++ b/src/vocode/types/play_ht_voice_version.py @@ -1,17 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -import enum import typing -T_Result = typing.TypeVar("T_Result") - - -class PlayHtVoiceVersion(str, enum.Enum): - ONE = "1" - TWO = "2" - - def visit(self, one: typing.Callable[[], T_Result], two: typing.Callable[[], T_Result]) -> T_Result: - if self is PlayHtVoiceVersion.ONE: - return one() - if self is PlayHtVoiceVersion.TWO: - return two() +PlayHtVoiceVersion = typing.Union[typing.Literal["1", "2"], typing.Any] diff --git a/src/vocode/types/prompt.py b/src/vocode/types/prompt.py index c82d3a9..5f6cc9d 100644 --- a/src/vocode/types/prompt.py +++ b/src/vocode/types/prompt.py @@ -1,35 +1,26 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .collect_field import CollectField from .prompt_template import PromptTemplate - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class Prompt(pydantic.BaseModel): +class Prompt(UniversalBaseModel): id: str user_id: str - content: typing.Optional[str] - collect_fields: typing.Optional[typing.List[CollectField]] - context_endpoint: typing.Optional[str] - prompt_template: typing.Optional[PromptTemplate] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + content: typing.Optional[str] = None + collect_fields: typing.Optional[typing.List[CollectField]] = None + context_endpoint: typing.Optional[str] = None + prompt_template: typing.Optional[PromptTemplate] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/prompt_page.py b/src/vocode/types/prompt_page.py index 6e579bd..7e3caae 100644 --- a/src/vocode/types/prompt_page.py +++ b/src/vocode/types/prompt_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .normalized_prompt import NormalizedPrompt - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class PromptPage(pydantic.BaseModel): +class PromptPage(UniversalBaseModel): items: typing.List[NormalizedPrompt] page: int size: int @@ -20,15 +15,11 @@ class PromptPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/prompt_params.py b/src/vocode/types/prompt_params.py index 6ff7490..89e6ad3 100644 --- a/src/vocode/types/prompt_params.py +++ b/src/vocode/types/prompt_params.py @@ -1,33 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .collect_field import CollectField from .prompt_params_prompt_template import PromptParamsPromptTemplate +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PromptParams(pydantic.BaseModel): - content: typing.Optional[str] - collect_fields: typing.Optional[typing.List[CollectField]] - context_endpoint: typing.Optional[str] - prompt_template: typing.Optional[PromptParamsPromptTemplate] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class PromptParams(UniversalBaseModel): + content: typing.Optional[str] = None + collect_fields: typing.Optional[typing.List[CollectField]] = None + context_endpoint: typing.Optional[str] = None + prompt_template: typing.Optional[PromptParamsPromptTemplate] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/prompt_params_prompt_template.py b/src/vocode/types/prompt_params_prompt_template.py index 7920d7c..16fc9bc 100644 --- a/src/vocode/types/prompt_params_prompt_template.py +++ b/src/vocode/types/prompt_params_prompt_template.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .prompt_template import PromptTemplate PromptParamsPromptTemplate = typing.Union[str, PromptTemplate] diff --git a/src/vocode/types/prompt_template.py b/src/vocode/types/prompt_template.py index e4d3e96..5f6dbb2 100644 --- a/src/vocode/types/prompt_template.py +++ b/src/vocode/types/prompt_template.py @@ -1,31 +1,22 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PromptTemplate(pydantic.BaseModel): +class PromptTemplate(UniversalBaseModel): id: str user_id: str - label: typing.Optional[str] + label: typing.Optional[str] = None required_context_keys: typing.List[str] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/prompt_update_params.py b/src/vocode/types/prompt_update_params.py index f80cee8..724e099 100644 --- a/src/vocode/types/prompt_update_params.py +++ b/src/vocode/types/prompt_update_params.py @@ -1,35 +1,26 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .prompt_update_params_collect_fields import PromptUpdateParamsCollectFields from .prompt_update_params_content import PromptUpdateParamsContent +from .prompt_update_params_collect_fields import PromptUpdateParamsCollectFields from .prompt_update_params_context_endpoint import PromptUpdateParamsContextEndpoint from .prompt_update_params_prompt_template import PromptUpdateParamsPromptTemplate +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class PromptUpdateParams(pydantic.BaseModel): - content: typing.Optional[PromptUpdateParamsContent] - collect_fields: typing.Optional[PromptUpdateParamsCollectFields] - context_endpoint: typing.Optional[PromptUpdateParamsContextEndpoint] - prompt_template: typing.Optional[PromptUpdateParamsPromptTemplate] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class PromptUpdateParams(UniversalBaseModel): + content: typing.Optional[PromptUpdateParamsContent] = None + collect_fields: typing.Optional[PromptUpdateParamsCollectFields] = None + context_endpoint: typing.Optional[PromptUpdateParamsContextEndpoint] = None + prompt_template: typing.Optional[PromptUpdateParamsPromptTemplate] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/prompt_update_params_collect_fields.py b/src/vocode/types/prompt_update_params_collect_fields.py index 7cfcffd..c4fdfc7 100644 --- a/src/vocode/types/prompt_update_params_collect_fields.py +++ b/src/vocode/types/prompt_update_params_collect_fields.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .collect_field import CollectField from .undefined import Undefined diff --git a/src/vocode/types/prompt_update_params_content.py b/src/vocode/types/prompt_update_params_content.py index f2f7a3d..6d960ba 100644 --- a/src/vocode/types/prompt_update_params_content.py +++ b/src/vocode/types/prompt_update_params_content.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PromptUpdateParamsContent = typing.Union[str, Undefined] diff --git a/src/vocode/types/prompt_update_params_context_endpoint.py b/src/vocode/types/prompt_update_params_context_endpoint.py index ee9b9db..d605efa 100644 --- a/src/vocode/types/prompt_update_params_context_endpoint.py +++ b/src/vocode/types/prompt_update_params_context_endpoint.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined PromptUpdateParamsContextEndpoint = typing.Union[str, Undefined] diff --git a/src/vocode/types/prompt_update_params_prompt_template.py b/src/vocode/types/prompt_update_params_prompt_template.py index 086303e..853faf0 100644 --- a/src/vocode/types/prompt_update_params_prompt_template.py +++ b/src/vocode/types/prompt_update_params_prompt_template.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .prompt_template import PromptTemplate from .undefined import Undefined diff --git a/src/vocode/types/rime_voice.py b/src/vocode/types/rime_voice.py index 8163e39..2423bff 100644 --- a/src/vocode/types/rime_voice.py +++ b/src/vocode/types/rime_voice.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .rime_voice_model_id import RimeVoiceModelId - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class RimeVoice(pydantic.BaseModel): +class RimeVoice(UniversalBaseModel): id: str user_id: str + type: typing.Literal["voice_rime"] = "voice_rime" speaker: str - speed_alpha: typing.Optional[float] - model_id: typing.Optional[RimeVoiceModelId] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + speed_alpha: typing.Optional[float] = None + model_id: typing.Optional[RimeVoiceModelId] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/rime_voice_model_id.py b/src/vocode/types/rime_voice_model_id.py index 41b4eec..2084572 100644 --- a/src/vocode/types/rime_voice_model_id.py +++ b/src/vocode/types/rime_voice_model_id.py @@ -1,9 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined -RimeVoiceModelId = typing.Union[typing_extensions.Literal["mist"], typing_extensions.Literal["v1"], Undefined] +RimeVoiceModelId = typing.Union[typing.Literal["mist"], typing.Literal["v1"], Undefined] diff --git a/src/vocode/types/rime_voice_params_model_id.py b/src/vocode/types/rime_voice_params_model_id.py index 20db3d9..d4eb77e 100644 --- a/src/vocode/types/rime_voice_params_model_id.py +++ b/src/vocode/types/rime_voice_params_model_id.py @@ -1,9 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined -RimeVoiceParamsModelId = typing.Union[typing_extensions.Literal["mist"], typing_extensions.Literal["v1"], Undefined] +RimeVoiceParamsModelId = typing.Union[typing.Literal["mist"], typing.Literal["v1"], Undefined] diff --git a/src/vocode/types/rime_voice_update_params_model_id.py b/src/vocode/types/rime_voice_update_params_model_id.py index 77db336..08e3eaf 100644 --- a/src/vocode/types/rime_voice_update_params_model_id.py +++ b/src/vocode/types/rime_voice_update_params_model_id.py @@ -1,11 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - -import typing_extensions - from .undefined import Undefined -RimeVoiceUpdateParamsModelId = typing.Union[ - typing_extensions.Literal["mist"], typing_extensions.Literal["v1"], Undefined -] +RimeVoiceUpdateParamsModelId = typing.Union[typing.Literal["mist"], typing.Literal["v1"], Undefined] diff --git a/src/vocode/types/rime_voice_update_params_speaker.py b/src/vocode/types/rime_voice_update_params_speaker.py index 994991b..f5f1b07 100644 --- a/src/vocode/types/rime_voice_update_params_speaker.py +++ b/src/vocode/types/rime_voice_update_params_speaker.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined RimeVoiceUpdateParamsSpeaker = typing.Union[str, Undefined] diff --git a/src/vocode/types/rime_voice_update_params_speed_alpha.py b/src/vocode/types/rime_voice_update_params_speed_alpha.py index 4ec72b2..ae65305 100644 --- a/src/vocode/types/rime_voice_update_params_speed_alpha.py +++ b/src/vocode/types/rime_voice_update_params_speed_alpha.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined RimeVoiceUpdateParamsSpeedAlpha = typing.Union[float, Undefined] diff --git a/src/vocode/types/set_hold_action.py b/src/vocode/types/set_hold_action.py index e8801e0..d0163a8 100644 --- a/src/vocode/types/set_hold_action.py +++ b/src/vocode/types/set_hold_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .empty_action_config import EmptyActionConfig from .set_hold_action_action_trigger import SetHoldActionActionTrigger - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class SetHoldAction(pydantic.BaseModel): +class SetHoldAction(UniversalBaseModel): id: str user_id: str - config: typing.Optional[EmptyActionConfig] - action_trigger: typing.Optional[SetHoldActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + type: typing.Literal["action_set_hold"] = "action_set_hold" + config: typing.Optional[EmptyActionConfig] = None + action_trigger: typing.Optional[SetHoldActionActionTrigger] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/set_hold_action_action_trigger.py b/src/vocode/types/set_hold_action_action_trigger.py index b8b788b..be72145 100644 --- a/src/vocode/types/set_hold_action_action_trigger.py +++ b/src/vocode/types/set_hold_action_action_trigger.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class SetHoldActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class SetHoldActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_output import PhraseBasedActionTriggerOutput -SetHoldActionActionTrigger = typing.Union[ - SetHoldActionActionTrigger_ActionTriggerFunctionCall, SetHoldActionActionTrigger_ActionTriggerPhraseBased -] +SetHoldActionActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerOutput] diff --git a/src/vocode/types/set_hold_action_params_action_trigger.py b/src/vocode/types/set_hold_action_params_action_trigger.py index c07e968..253934d 100644 --- a/src/vocode/types/set_hold_action_params_action_trigger.py +++ b/src/vocode/types/set_hold_action_params_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -SetHoldActionParamsActionTrigger = typing.Union[ - SetHoldActionParamsActionTrigger_ActionTriggerFunctionCall, - SetHoldActionParamsActionTrigger_ActionTriggerPhraseBased, -] +SetHoldActionParamsActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/set_hold_action_update_params_action_trigger.py b/src/vocode/types/set_hold_action_update_params_action_trigger.py index 6781559..fedbe6f 100644 --- a/src/vocode/types/set_hold_action_update_params_action_trigger.py +++ b/src/vocode/types/set_hold_action_update_params_action_trigger.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .set_hold_action_update_params_action_trigger_zero import SetHoldActionUpdateParamsActionTriggerZero from .undefined import Undefined diff --git a/src/vocode/types/set_hold_action_update_params_action_trigger_zero.py b/src/vocode/types/set_hold_action_update_params_action_trigger_zero.py index e941f80..25c32bc 100644 --- a/src/vocode/types/set_hold_action_update_params_action_trigger_zero.py +++ b/src/vocode/types/set_hold_action_update_params_action_trigger_zero.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -SetHoldActionUpdateParamsActionTriggerZero = typing.Union[ - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - SetHoldActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -] +SetHoldActionUpdateParamsActionTriggerZero = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/set_hold_action_update_params_config.py b/src/vocode/types/set_hold_action_update_params_config.py index c9a8019..d856cf2 100644 --- a/src/vocode/types/set_hold_action_update_params_config.py +++ b/src/vocode/types/set_hold_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .empty_action_config import EmptyActionConfig from .undefined import Undefined diff --git a/src/vocode/types/transfer_call_action.py b/src/vocode/types/transfer_call_action.py index 5ec7662..2ded491 100644 --- a/src/vocode/types/transfer_call_action.py +++ b/src/vocode/types/transfer_call_action.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .transfer_call_action_action_trigger import TransferCallActionActionTrigger from .transfer_call_config import TransferCallConfig - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from .transfer_call_action_action_trigger import TransferCallActionActionTrigger +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class TransferCallAction(pydantic.BaseModel): +class TransferCallAction(UniversalBaseModel): id: str user_id: str + type: typing.Literal["action_transfer_call"] = "action_transfer_call" config: TransferCallConfig - action_trigger: typing.Optional[TransferCallActionActionTrigger] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + action_trigger: typing.Optional[TransferCallActionActionTrigger] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/transfer_call_action_action_trigger.py b/src/vocode/types/transfer_call_action_action_trigger.py index f37bd47..95afaf8 100644 --- a/src/vocode/types/transfer_call_action_action_trigger.py +++ b/src/vocode/types/transfer_call_action_action_trigger.py @@ -1,33 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class TransferCallActionActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class TransferCallActionActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_output import PhraseBasedActionTriggerOutput -TransferCallActionActionTrigger = typing.Union[ - TransferCallActionActionTrigger_ActionTriggerFunctionCall, TransferCallActionActionTrigger_ActionTriggerPhraseBased -] +TransferCallActionActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerOutput] diff --git a/src/vocode/types/transfer_call_action_params_action_trigger.py b/src/vocode/types/transfer_call_action_params_action_trigger.py index 7addf1d..8e1901d 100644 --- a/src/vocode/types/transfer_call_action_params_action_trigger.py +++ b/src/vocode/types/transfer_call_action_params_action_trigger.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -TransferCallActionParamsActionTrigger = typing.Union[ - TransferCallActionParamsActionTrigger_ActionTriggerFunctionCall, - TransferCallActionParamsActionTrigger_ActionTriggerPhraseBased, -] +TransferCallActionParamsActionTrigger = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/transfer_call_action_update_params_action_trigger.py b/src/vocode/types/transfer_call_action_update_params_action_trigger.py index e2bcee0..42370c5 100644 --- a/src/vocode/types/transfer_call_action_update_params_action_trigger.py +++ b/src/vocode/types/transfer_call_action_update_params_action_trigger.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .transfer_call_action_update_params_action_trigger_zero import TransferCallActionUpdateParamsActionTriggerZero from .undefined import Undefined diff --git a/src/vocode/types/transfer_call_action_update_params_action_trigger_zero.py b/src/vocode/types/transfer_call_action_update_params_action_trigger_zero.py index 5fb6fa7..4a40500 100644 --- a/src/vocode/types/transfer_call_action_update_params_action_trigger_zero.py +++ b/src/vocode/types/transfer_call_action_update_params_action_trigger_zero.py @@ -1,34 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .function_call_action_trigger import FunctionCallActionTrigger -from .phrase_based_action_trigger import PhraseBasedActionTrigger - - -class TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall(FunctionCallActionTrigger): - type: typing_extensions.Literal["action_trigger_function_call"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased(PhraseBasedActionTrigger): - type: typing_extensions.Literal["action_trigger_phrase_based"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - +from .phrase_based_action_trigger_input import PhraseBasedActionTriggerInput -TransferCallActionUpdateParamsActionTriggerZero = typing.Union[ - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerFunctionCall, - TransferCallActionUpdateParamsActionTriggerZero_ActionTriggerPhraseBased, -] +TransferCallActionUpdateParamsActionTriggerZero = typing.Union[FunctionCallActionTrigger, PhraseBasedActionTriggerInput] diff --git a/src/vocode/types/transfer_call_action_update_params_config.py b/src/vocode/types/transfer_call_action_update_params_config.py index 4a5787f..c86fdce 100644 --- a/src/vocode/types/transfer_call_action_update_params_config.py +++ b/src/vocode/types/transfer_call_action_update_params_config.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .transfer_call_config import TransferCallConfig from .undefined import Undefined diff --git a/src/vocode/types/transfer_call_config.py b/src/vocode/types/transfer_call_config.py index 8d657d4..3617067 100644 --- a/src/vocode/types/transfer_call_config.py +++ b/src/vocode/types/transfer_call_config.py @@ -1,28 +1,19 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class TransferCallConfig(pydantic.BaseModel): +class TransferCallConfig(UniversalBaseModel): phone_number: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/twilio_account_connection.py b/src/vocode/types/twilio_account_connection.py index 61e5028..645ceba 100644 --- a/src/vocode/types/twilio_account_connection.py +++ b/src/vocode/types/twilio_account_connection.py @@ -1,33 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import UniversalBaseModel from .twilio_credentials import TwilioCredentials - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class TwilioAccountConnection(pydantic.BaseModel): +class TwilioAccountConnection(UniversalBaseModel): id: str user_id: str credentials: TwilioCredentials - steering_pool: typing.Optional[typing.List[str]] - account_supports_any_caller_id: typing.Optional[bool] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + type: typing.Literal["account_connection_twilio"] = "account_connection_twilio" + steering_pool: typing.Optional[typing.List[str]] = None + account_supports_any_caller_id: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/twilio_account_connection_params.py b/src/vocode/types/twilio_account_connection_params.py index c9e7721..72e2d48 100644 --- a/src/vocode/types/twilio_account_connection_params.py +++ b/src/vocode/types/twilio_account_connection_params.py @@ -1,31 +1,23 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import UniversalBaseModel from .twilio_credentials import TwilioCredentials - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class TwilioAccountConnectionParams(pydantic.BaseModel): +class TwilioAccountConnectionParams(UniversalBaseModel): credentials: TwilioCredentials - steering_pool: typing.Optional[typing.List[str]] - account_supports_any_caller_id: typing.Optional[bool] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + type: typing.Literal["account_connection_twilio"] = "account_connection_twilio" + steering_pool: typing.Optional[typing.List[str]] = None + account_supports_any_caller_id: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/twilio_account_connection_update_params.py b/src/vocode/types/twilio_account_connection_update_params.py index f76078d..3059b13 100644 --- a/src/vocode/types/twilio_account_connection_update_params.py +++ b/src/vocode/types/twilio_account_connection_update_params.py @@ -1,29 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .twilio_account_connection_update_params_credentials import TwilioAccountConnectionUpdateParamsCredentials +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class TwilioAccountConnectionUpdateParams(pydantic.BaseModel): - credentials: typing.Optional[TwilioAccountConnectionUpdateParamsCredentials] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class TwilioAccountConnectionUpdateParams(UniversalBaseModel): + credentials: typing.Optional[TwilioAccountConnectionUpdateParamsCredentials] = None + type: typing.Literal["account_connection_twilio"] = "account_connection_twilio" - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/twilio_account_connection_update_params_credentials.py b/src/vocode/types/twilio_account_connection_update_params_credentials.py index 98d8031..142880c 100644 --- a/src/vocode/types/twilio_account_connection_update_params_credentials.py +++ b/src/vocode/types/twilio_account_connection_update_params_credentials.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .twilio_credentials import TwilioCredentials from .undefined import Undefined diff --git a/src/vocode/types/twilio_credentials.py b/src/vocode/types/twilio_credentials.py index e5e15d1..c61c756 100644 --- a/src/vocode/types/twilio_credentials.py +++ b/src/vocode/types/twilio_credentials.py @@ -1,29 +1,20 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class TwilioCredentials(pydantic.BaseModel): +class TwilioCredentials(UniversalBaseModel): twilio_account_sid: str twilio_auth_token: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/twilio_telephony_metadata.py b/src/vocode/types/twilio_telephony_metadata.py index cfeb261..8669a7a 100644 --- a/src/vocode/types/twilio_telephony_metadata.py +++ b/src/vocode/types/twilio_telephony_metadata.py @@ -1,32 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class TwilioTelephonyMetadata(pydantic.BaseModel): - call_sid: typing.Optional[str] - call_status: typing.Optional[str] - transfer_call_sid: typing.Optional[str] - transfer_call_status: typing.Optional[str] - conference_sid: typing.Optional[str] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class TwilioTelephonyMetadata(UniversalBaseModel): + type: typing.Literal["telephony_metadata_twilio"] = "telephony_metadata_twilio" + call_sid: typing.Optional[str] = None + call_status: typing.Optional[str] = None + transfer_call_sid: typing.Optional[str] = None + transfer_call_status: typing.Optional[str] = None + conference_sid: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/undefined.py b/src/vocode/types/undefined.py index 4692411..e5e8f24 100644 --- a/src/vocode/types/undefined.py +++ b/src/vocode/types/undefined.py @@ -1,26 +1,17 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +class Undefined(UniversalBaseModel): + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - -class Undefined(pydantic.BaseModel): - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/usage.py b/src/vocode/types/usage.py index 0ee9a4f..b49a3c6 100644 --- a/src/vocode/types/usage.py +++ b/src/vocode/types/usage.py @@ -1,32 +1,23 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import UniversalBaseModel from .plan_type import PlanType - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class Usage(pydantic.BaseModel): +class Usage(UniversalBaseModel): user_id: str plan_type: PlanType monthly_usage_minutes: int - monthly_usage_limit_minutes: typing.Optional[int] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + monthly_usage_limit_minutes: typing.Optional[int] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/validation_error.py b/src/vocode/types/validation_error.py index 67b5ba7..93a2d80 100644 --- a/src/vocode/types/validation_error.py +++ b/src/vocode/types/validation_error.py @@ -1,31 +1,22 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .validation_error_loc_item import ValidationErrorLocItem - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class ValidationError(pydantic.BaseModel): +class ValidationError(UniversalBaseModel): loc: typing.List[ValidationErrorLocItem] msg: str type: str - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/vector_database_page.py b/src/vocode/types/vector_database_page.py index b8b5e46..4016d5a 100644 --- a/src/vocode/types/vector_database_page.py +++ b/src/vocode/types/vector_database_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .pinecone_vector_database import PineconeVectorDatabase - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class VectorDatabasePage(pydantic.BaseModel): +class VectorDatabasePage(UniversalBaseModel): items: typing.List[PineconeVectorDatabase] page: int size: int @@ -20,15 +15,11 @@ class VectorDatabasePage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/vocode_voice.py b/src/vocode/types/vocode_voice.py new file mode 100644 index 0000000..040aac2 --- /dev/null +++ b/src/vocode/types/vocode_voice.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class VocodeVoice(UniversalBaseModel): + id: str + user_id: str + type: typing.Literal["voice_vocode"] = "voice_vocode" + voice_id: typing.Literal["joe"] = "joe" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/vocode_voice_params.py b/src/vocode/types/vocode_voice_params.py new file mode 100644 index 0000000..fd63504 --- /dev/null +++ b/src/vocode/types/vocode_voice_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class VocodeVoiceParams(UniversalBaseModel): + type: typing.Literal["voice_vocode"] = "voice_vocode" + voice_id: typing.Literal["joe"] = "joe" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/vocode_voice_update_params.py b/src/vocode/types/vocode_voice_update_params.py new file mode 100644 index 0000000..8179fd1 --- /dev/null +++ b/src/vocode/types/vocode_voice_update_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from .vocode_voice_update_params_voice_id import VocodeVoiceUpdateParamsVoiceId +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class VocodeVoiceUpdateParams(UniversalBaseModel): + type: typing.Literal["voice_vocode"] = "voice_vocode" + voice_id: typing.Optional[VocodeVoiceUpdateParamsVoiceId] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/vocode_voice_update_params_voice_id.py b/src/vocode/types/vocode_voice_update_params_voice_id.py new file mode 100644 index 0000000..a71ac70 --- /dev/null +++ b/src/vocode/types/vocode_voice_update_params_voice_id.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from .undefined import Undefined + +VocodeVoiceUpdateParamsVoiceId = typing.Union[typing.Literal["joe"], Undefined] diff --git a/src/vocode/types/voice_page.py b/src/vocode/types/voice_page.py index 411a612..e1fbd58 100644 --- a/src/vocode/types/voice_page.py +++ b/src/vocode/types/voice_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .voice_page_items_item import VoicePageItemsItem - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class VoicePage(pydantic.BaseModel): +class VoicePage(UniversalBaseModel): items: typing.List[VoicePageItemsItem] page: int size: int @@ -20,15 +15,11 @@ class VoicePage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/voice_page_items_item.py b/src/vocode/types/voice_page_items_item.py index 1eebc7b..c19e76e 100644 --- a/src/vocode/types/voice_page_items_item.py +++ b/src/vocode/types/voice_page_items_item.py @@ -1,56 +1,10 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .azure_voice import AzureVoice from .eleven_labs_voice import ElevenLabsVoice from .play_ht_voice import PlayHtVoice from .rime_voice import RimeVoice +from .vocode_voice import VocodeVoice - -class VoicePageItemsItem_VoiceAzure(AzureVoice): - type: typing_extensions.Literal["voice_azure"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoicePageItemsItem_VoiceRime(RimeVoice): - type: typing_extensions.Literal["voice_rime"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoicePageItemsItem_VoiceElevenLabs(ElevenLabsVoice): - type: typing_extensions.Literal["voice_eleven_labs"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoicePageItemsItem_VoicePlayHt(PlayHtVoice): - type: typing_extensions.Literal["voice_play_ht"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -VoicePageItemsItem = typing.Union[ - VoicePageItemsItem_VoiceAzure, - VoicePageItemsItem_VoiceRime, - VoicePageItemsItem_VoiceElevenLabs, - VoicePageItemsItem_VoicePlayHt, -] +VoicePageItemsItem = typing.Union[AzureVoice, ElevenLabsVoice, PlayHtVoice, RimeVoice, VocodeVoice] diff --git a/src/vocode/types/voice_response_model.py b/src/vocode/types/voice_response_model.py index a9ce928..f3ed579 100644 --- a/src/vocode/types/voice_response_model.py +++ b/src/vocode/types/voice_response_model.py @@ -1,56 +1,10 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations - import typing - -import typing_extensions - from .azure_voice import AzureVoice from .eleven_labs_voice import ElevenLabsVoice from .play_ht_voice import PlayHtVoice from .rime_voice import RimeVoice +from .vocode_voice import VocodeVoice - -class VoiceResponseModel_VoiceAzure(AzureVoice): - type: typing_extensions.Literal["voice_azure"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoiceResponseModel_VoiceRime(RimeVoice): - type: typing_extensions.Literal["voice_rime"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoiceResponseModel_VoiceElevenLabs(ElevenLabsVoice): - type: typing_extensions.Literal["voice_eleven_labs"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -class VoiceResponseModel_VoicePlayHt(PlayHtVoice): - type: typing_extensions.Literal["voice_play_ht"] - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - - -VoiceResponseModel = typing.Union[ - VoiceResponseModel_VoiceAzure, - VoiceResponseModel_VoiceRime, - VoiceResponseModel_VoiceElevenLabs, - VoiceResponseModel_VoicePlayHt, -] +VoiceResponseModel = typing.Union[AzureVoice, ElevenLabsVoice, PlayHtVoice, RimeVoice, VocodeVoice] diff --git a/src/vocode/types/vonage_telephony_metadata.py b/src/vocode/types/vonage_telephony_metadata.py index df81116..08dadf2 100644 --- a/src/vocode/types/vonage_telephony_metadata.py +++ b/src/vocode/types/vonage_telephony_metadata.py @@ -1,26 +1,19 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -from ..core.datetime_utils import serialize_datetime -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +class VonageTelephonyMetadata(UniversalBaseModel): + type: typing.Literal["telephony_metadata_vonage"] = "telephony_metadata_vonage" + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: -class VonageTelephonyMetadata(pydantic.BaseModel): - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/webhook.py b/src/vocode/types/webhook.py index d739868..81db3a1 100644 --- a/src/vocode/types/webhook.py +++ b/src/vocode/types/webhook.py @@ -1,34 +1,25 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .event_type import EventType from .http_method import HttpMethod - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class Webhook(pydantic.BaseModel): +class Webhook(UniversalBaseModel): id: str user_id: str subscriptions: typing.List[EventType] url: str - method: typing.Optional[HttpMethod] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + method: typing.Optional[HttpMethod] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/webhook_page.py b/src/vocode/types/webhook_page.py index c795566..c4d42ad 100644 --- a/src/vocode/types/webhook_page.py +++ b/src/vocode/types/webhook_page.py @@ -1,18 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .webhook import Webhook - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class WebhookPage(pydantic.BaseModel): +class WebhookPage(UniversalBaseModel): items: typing.List[Webhook] page: int size: int @@ -20,15 +15,11 @@ class WebhookPage(pydantic.BaseModel): total: int total_is_estimated: bool - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/webhook_params.py b/src/vocode/types/webhook_params.py index 6118f6e..361581b 100644 --- a/src/vocode/types/webhook_params.py +++ b/src/vocode/types/webhook_params.py @@ -1,32 +1,23 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime from .event_type import EventType from .http_method import HttpMethod - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -class WebhookParams(pydantic.BaseModel): +class WebhookParams(UniversalBaseModel): subscriptions: typing.List[EventType] url: str - method: typing.Optional[HttpMethod] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) + method: typing.Optional[HttpMethod] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/webhook_update_params.py b/src/vocode/types/webhook_update_params.py index ae979f8..5634ef6 100644 --- a/src/vocode/types/webhook_update_params.py +++ b/src/vocode/types/webhook_update_params.py @@ -1,33 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt +from ..core.pydantic_utilities import UniversalBaseModel import typing - -from ..core.datetime_utils import serialize_datetime -from .webhook_update_params_method import WebhookUpdateParamsMethod from .webhook_update_params_subscriptions import WebhookUpdateParamsSubscriptions from .webhook_update_params_url import WebhookUpdateParamsUrl +from .webhook_update_params_method import WebhookUpdateParamsMethod +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class WebhookUpdateParams(pydantic.BaseModel): - subscriptions: typing.Optional[WebhookUpdateParamsSubscriptions] - url: typing.Optional[WebhookUpdateParamsUrl] - method: typing.Optional[WebhookUpdateParamsMethod] - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) +class WebhookUpdateParams(UniversalBaseModel): + subscriptions: typing.Optional[WebhookUpdateParamsSubscriptions] = None + url: typing.Optional[WebhookUpdateParamsUrl] = None + method: typing.Optional[WebhookUpdateParamsMethod] = None - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/vocode/types/webhook_update_params_method.py b/src/vocode/types/webhook_update_params_method.py index 467e281..c7539e2 100644 --- a/src/vocode/types/webhook_update_params_method.py +++ b/src/vocode/types/webhook_update_params_method.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .http_method import HttpMethod from .undefined import Undefined diff --git a/src/vocode/types/webhook_update_params_subscriptions.py b/src/vocode/types/webhook_update_params_subscriptions.py index 7ee057b..aafa816 100644 --- a/src/vocode/types/webhook_update_params_subscriptions.py +++ b/src/vocode/types/webhook_update_params_subscriptions.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .event_type import EventType from .undefined import Undefined diff --git a/src/vocode/types/webhook_update_params_url.py b/src/vocode/types/webhook_update_params_url.py index a955df0..349e5a4 100644 --- a/src/vocode/types/webhook_update_params_url.py +++ b/src/vocode/types/webhook_update_params_url.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. import typing - from .undefined import Undefined WebhookUpdateParamsUrl = typing.Union[str, Undefined] diff --git a/src/vocode/resources/vector_databases/__init__.py b/src/vocode/usage/__init__.py similarity index 100% rename from src/vocode/resources/vector_databases/__init__.py rename to src/vocode/usage/__init__.py diff --git a/src/vocode/usage/client.py b/src/vocode/usage/client.py new file mode 100644 index 0000000..0a3fb11 --- /dev/null +++ b/src/vocode/usage/client.py @@ -0,0 +1,108 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import SyncClientWrapper +import typing +from ..core.request_options import RequestOptions +from ..types.usage import Usage +from ..core.pydantic_utilities import parse_obj_as +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper + + +class UsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_usage(self, *, request_options: typing.Optional[RequestOptions] = None) -> Usage: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Usage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.usage.get_usage() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/usage", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Usage, + parse_obj_as( + type_=Usage, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_usage(self, *, request_options: typing.Optional[RequestOptions] = None) -> Usage: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Usage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.usage.get_usage() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/usage", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Usage, + parse_obj_as( + type_=Usage, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/resources/voices/__init__.py b/src/vocode/vector_databases/__init__.py similarity index 100% rename from src/vocode/resources/voices/__init__.py rename to src/vocode/vector_databases/__init__.py diff --git a/src/vocode/vector_databases/client.py b/src/vocode/vector_databases/client.py new file mode 100644 index 0000000..47e1940 --- /dev/null +++ b/src/vocode/vector_databases/client.py @@ -0,0 +1,619 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.pinecone_vector_database import PineconeVectorDatabase +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.vector_database_page import VectorDatabasePage +from ..types.pinecone_vector_database_update_params_index import PineconeVectorDatabaseUpdateParamsIndex +from ..types.pinecone_vector_database_update_params_api_key import PineconeVectorDatabaseUpdateParamsApiKey +from ..types.pinecone_vector_database_update_params_api_environment import ( + PineconeVectorDatabaseUpdateParamsApiEnvironment, +) +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VectorDatabasesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_vector_database( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.vector_databases.get_vector_database( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/vector_databases", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_vector_databases( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VectorDatabasePage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VectorDatabasePage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.vector_databases.list_vector_databases() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/vector_databases/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VectorDatabasePage, + parse_obj_as( + type_=VectorDatabasePage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_vector_database( + self, *, index: str, api_key: str, api_environment: str, request_options: typing.Optional[RequestOptions] = None + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + index : str + + api_key : str + + api_environment : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.vector_databases.create_vector_database( + index="index", + api_key="api_key", + api_environment="api_environment", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/vector_databases/create", + method="POST", + json={ + "index": index, + "api_key": api_key, + "api_environment": api_environment, + "type": "vector_database_pinecone", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_vector_database( + self, + *, + id: str, + index: typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] = OMIT, + api_key: typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] = OMIT, + api_environment: typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + id : str + + index : typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] + + api_key : typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] + + api_environment : typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.vector_databases.update_vector_database( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/vector_databases/update", + method="POST", + params={ + "id": id, + }, + json={ + "index": index, + "api_key": api_key, + "api_environment": api_environment, + "type": "vector_database_pinecone", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncVectorDatabasesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_vector_database( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.vector_databases.get_vector_database( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/vector_databases", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_vector_databases( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VectorDatabasePage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VectorDatabasePage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.vector_databases.list_vector_databases() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/vector_databases/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VectorDatabasePage, + parse_obj_as( + type_=VectorDatabasePage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_vector_database( + self, *, index: str, api_key: str, api_environment: str, request_options: typing.Optional[RequestOptions] = None + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + index : str + + api_key : str + + api_environment : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.vector_databases.create_vector_database( + index="index", + api_key="api_key", + api_environment="api_environment", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/vector_databases/create", + method="POST", + json={ + "index": index, + "api_key": api_key, + "api_environment": api_environment, + "type": "vector_database_pinecone", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_vector_database( + self, + *, + id: str, + index: typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] = OMIT, + api_key: typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] = OMIT, + api_environment: typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PineconeVectorDatabase: + """ + Parameters + ---------- + id : str + + index : typing.Optional[PineconeVectorDatabaseUpdateParamsIndex] + + api_key : typing.Optional[PineconeVectorDatabaseUpdateParamsApiKey] + + api_environment : typing.Optional[PineconeVectorDatabaseUpdateParamsApiEnvironment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PineconeVectorDatabase + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.vector_databases.update_vector_database( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/vector_databases/update", + method="POST", + params={ + "id": id, + }, + json={ + "index": index, + "api_key": api_key, + "api_environment": api_environment, + "type": "vector_database_pinecone", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + PineconeVectorDatabase, + parse_obj_as( + type_=PineconeVectorDatabase, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/version.py b/src/vocode/version.py new file mode 100644 index 0000000..57057e6 --- /dev/null +++ b/src/vocode/version.py @@ -0,0 +1,3 @@ +from importlib import metadata + +__version__ = metadata.version("vocode-api") diff --git a/src/vocode/resources/webhooks/__init__.py b/src/vocode/voices/__init__.py similarity index 100% rename from src/vocode/resources/webhooks/__init__.py rename to src/vocode/voices/__init__.py diff --git a/src/vocode/voices/client.py b/src/vocode/voices/client.py new file mode 100644 index 0000000..6f0e668 --- /dev/null +++ b/src/vocode/voices/client.py @@ -0,0 +1,568 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.voice_response_model import VoiceResponseModel +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.voice_page import VoicePage +from ..types.voice_params_request import VoiceParamsRequest +from ..types.voice_update_params_request import VoiceUpdateParamsRequest +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VoicesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_voice(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> VoiceResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.voices.get_voice( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_voices( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoicePage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoicePage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.voices.list_voices() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoicePage, + parse_obj_as( + type_=VoicePage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_voice( + self, *, request: VoiceParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceResponseModel: + """ + Parameters + ---------- + request : VoiceParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + from vocode import AzureVoiceParams, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.voices.create_voice( + request=AzureVoiceParams( + voice_name="voice_name", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_voice( + self, *, id: str, request: VoiceUpdateParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceResponseModel: + """ + Parameters + ---------- + id : str + + request : VoiceUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + from vocode import AzureVoiceUpdateParams, Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.voices.update_voice( + id="id", + request=AzureVoiceUpdateParams(), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncVoicesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_voice( + self, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceResponseModel: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.voices.get_voice( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_voices( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoicePage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoicePage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.voices.list_voices() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoicePage, + parse_obj_as( + type_=VoicePage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_voice( + self, *, request: VoiceParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceResponseModel: + """ + Parameters + ---------- + request : VoiceParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode, AzureVoiceParams + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.voices.create_voice( + request=AzureVoiceParams( + voice_name="voice_name", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/create", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_voice( + self, *, id: str, request: VoiceUpdateParamsRequest, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceResponseModel: + """ + Parameters + ---------- + id : str + + request : VoiceUpdateParamsRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode, AzureVoiceUpdateParams + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.voices.update_voice( + id="id", + request=AzureVoiceUpdateParams(), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/update", + method="POST", + params={ + "id": id, + }, + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + VoiceResponseModel, + parse_obj_as( + type_=VoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/vocode/webhooks/__init__.py b/src/vocode/webhooks/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/src/vocode/webhooks/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/src/vocode/webhooks/client.py b/src/vocode/webhooks/client.py new file mode 100644 index 0000000..31a7db2 --- /dev/null +++ b/src/vocode/webhooks/client.py @@ -0,0 +1,619 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from ..core.client_wrapper import SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.webhook import Webhook +from ..core.pydantic_utilities import parse_obj_as +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from json.decoder import JSONDecodeError +from ..core.api_error import ApiError +from ..types.webhook_page import WebhookPage +from ..types.event_type import EventType +from ..types.http_method import HttpMethod +from ..types.webhook_update_params_subscriptions import WebhookUpdateParamsSubscriptions +from ..types.webhook_update_params_url import WebhookUpdateParamsUrl +from ..types.webhook_update_params_method import WebhookUpdateParamsMethod +from ..core.client_wrapper import AsyncClientWrapper + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class WebhooksClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_webhook(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Webhook: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.webhooks.get_webhook( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/webhooks", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def list_webhooks( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WebhookPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WebhookPage + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.webhooks.list_webhooks() + """ + _response = self._client_wrapper.httpx_client.request( + "v1/webhooks/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + WebhookPage, + parse_obj_as( + type_=WebhookPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def create_webhook( + self, + *, + subscriptions: typing.Sequence[EventType], + url: str, + method: typing.Optional[HttpMethod] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Webhook: + """ + Parameters + ---------- + subscriptions : typing.Sequence[EventType] + + url : str + + method : typing.Optional[HttpMethod] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.webhooks.create_webhook( + subscriptions=["event_message"], + url="url", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/webhooks/create", + method="POST", + json={ + "subscriptions": subscriptions, + "url": url, + "method": method, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_webhook( + self, + *, + id: str, + subscriptions: typing.Optional[WebhookUpdateParamsSubscriptions] = OMIT, + url: typing.Optional[WebhookUpdateParamsUrl] = OMIT, + method: typing.Optional[WebhookUpdateParamsMethod] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Webhook: + """ + Parameters + ---------- + id : str + + subscriptions : typing.Optional[WebhookUpdateParamsSubscriptions] + + url : typing.Optional[WebhookUpdateParamsUrl] + + method : typing.Optional[WebhookUpdateParamsMethod] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + from vocode import Vocode + + client = Vocode( + token="YOUR_TOKEN", + ) + client.webhooks.update_webhook( + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/webhooks/update", + method="POST", + params={ + "id": id, + }, + json={ + "subscriptions": subscriptions, + "url": url, + "method": method, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncWebhooksClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_webhook(self, *, id: str, request_options: typing.Optional[RequestOptions] = None) -> Webhook: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.webhooks.get_webhook( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/webhooks", + method="GET", + params={ + "id": id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def list_webhooks( + self, + *, + page: typing.Optional[int] = None, + size: typing.Optional[int] = None, + sort_column: typing.Optional[str] = None, + sort_desc: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WebhookPage: + """ + Parameters + ---------- + page : typing.Optional[int] + + size : typing.Optional[int] + + sort_column : typing.Optional[str] + + sort_desc : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WebhookPage + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.webhooks.list_webhooks() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/webhooks/list", + method="GET", + params={ + "page": page, + "size": size, + "sort_column": sort_column, + "sort_desc": sort_desc, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + WebhookPage, + parse_obj_as( + type_=WebhookPage, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_webhook( + self, + *, + subscriptions: typing.Sequence[EventType], + url: str, + method: typing.Optional[HttpMethod] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Webhook: + """ + Parameters + ---------- + subscriptions : typing.Sequence[EventType] + + url : str + + method : typing.Optional[HttpMethod] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.webhooks.create_webhook( + subscriptions=["event_message"], + url="url", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/webhooks/create", + method="POST", + json={ + "subscriptions": subscriptions, + "url": url, + "method": method, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_webhook( + self, + *, + id: str, + subscriptions: typing.Optional[WebhookUpdateParamsSubscriptions] = OMIT, + url: typing.Optional[WebhookUpdateParamsUrl] = OMIT, + method: typing.Optional[WebhookUpdateParamsMethod] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Webhook: + """ + Parameters + ---------- + id : str + + subscriptions : typing.Optional[WebhookUpdateParamsSubscriptions] + + url : typing.Optional[WebhookUpdateParamsUrl] + + method : typing.Optional[WebhookUpdateParamsMethod] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Webhook + Successful Response + + Examples + -------- + import asyncio + + from vocode import AsyncVocode + + client = AsyncVocode( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.webhooks.update_webhook( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/webhooks/update", + method="POST", + params={ + "id": id, + }, + json={ + "subscriptions": subscriptions, + "url": url, + "method": method, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Webhook, + parse_obj_as( + type_=Webhook, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + parse_obj_as( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/custom/test_client.py b/tests/custom/test_client.py new file mode 100644 index 0000000..73f811f --- /dev/null +++ b/tests/custom/test_client.py @@ -0,0 +1,7 @@ +import pytest + + +# Get started with writing tests with pytest at https://docs.pytest.org +@pytest.mark.skip(reason="Unimplemented") +def test_client() -> None: + assert True == True diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/tests/utils/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/tests/utils/assets/models/__init__.py b/tests/utils/assets/models/__init__.py new file mode 100644 index 0000000..3a1c852 --- /dev/null +++ b/tests/utils/assets/models/__init__.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +from .circle import CircleParams +from .object_with_defaults import ObjectWithDefaultsParams +from .object_with_optional_field import ObjectWithOptionalFieldParams +from .shape import ShapeParams, Shape_CircleParams, Shape_SquareParams +from .square import SquareParams +from .undiscriminated_shape import UndiscriminatedShapeParams + +__all__ = [ + "CircleParams", + "ObjectWithDefaultsParams", + "ObjectWithOptionalFieldParams", + "ShapeParams", + "Shape_CircleParams", + "Shape_SquareParams", + "SquareParams", + "UndiscriminatedShapeParams", +] diff --git a/tests/utils/assets/models/circle.py b/tests/utils/assets/models/circle.py new file mode 100644 index 0000000..c2c64c9 --- /dev/null +++ b/tests/utils/assets/models/circle.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +import typing_extensions +from vocode.core.serialization import FieldMetadata + + +class CircleParams(typing_extensions.TypedDict): + radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")] diff --git a/tests/utils/assets/models/color.py b/tests/utils/assets/models/color.py new file mode 100644 index 0000000..2aa2c4c --- /dev/null +++ b/tests/utils/assets/models/color.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing + +Color = typing.Union[typing.Literal["red", "blue"], typing.Any] diff --git a/tests/utils/assets/models/object_with_defaults.py b/tests/utils/assets/models/object_with_defaults.py new file mode 100644 index 0000000..ef14f7b --- /dev/null +++ b/tests/utils/assets/models/object_with_defaults.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +import typing_extensions + + +class ObjectWithDefaultsParams(typing_extensions.TypedDict): + """ + Defines properties with default values and validation rules. + """ + + decimal: typing_extensions.NotRequired[float] + string: typing_extensions.NotRequired[str] + required_string: str diff --git a/tests/utils/assets/models/object_with_optional_field.py b/tests/utils/assets/models/object_with_optional_field.py new file mode 100644 index 0000000..f3f9a91 --- /dev/null +++ b/tests/utils/assets/models/object_with_optional_field.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +import typing +import typing_extensions +from vocode.core.serialization import FieldMetadata +import datetime as dt +import uuid +from .color import Color +from .shape import ShapeParams +from .undiscriminated_shape import UndiscriminatedShapeParams + + +class ObjectWithOptionalFieldParams(typing_extensions.TypedDict): + literal: typing.Literal["lit_one"] + string: typing_extensions.NotRequired[str] + integer: typing_extensions.NotRequired[int] + long_: typing_extensions.NotRequired[typing_extensions.Annotated[int, FieldMetadata(alias="long")]] + double: typing_extensions.NotRequired[float] + bool_: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="bool")]] + datetime: typing_extensions.NotRequired[dt.datetime] + date: typing_extensions.NotRequired[dt.date] + uuid_: typing_extensions.NotRequired[typing_extensions.Annotated[uuid.UUID, FieldMetadata(alias="uuid")]] + base_64: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="base64")]] + list_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Sequence[str], FieldMetadata(alias="list")]] + set_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Set[str], FieldMetadata(alias="set")]] + map_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Dict[int, str], FieldMetadata(alias="map")]] + enum: typing_extensions.NotRequired[Color] + union: typing_extensions.NotRequired[ShapeParams] + second_union: typing_extensions.NotRequired[ShapeParams] + undiscriminated_union: typing_extensions.NotRequired[UndiscriminatedShapeParams] + any: typing.Optional[typing.Any] diff --git a/tests/utils/assets/models/shape.py b/tests/utils/assets/models/shape.py new file mode 100644 index 0000000..75ba230 --- /dev/null +++ b/tests/utils/assets/models/shape.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations +import typing_extensions +import typing_extensions +import typing +from vocode.core.serialization import FieldMetadata + + +class Base(typing_extensions.TypedDict): + id: str + + +class Shape_CircleParams(Base): + shape_type: typing_extensions.Annotated[typing.Literal["circle"], FieldMetadata(alias="shapeType")] + radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")] + + +class Shape_SquareParams(Base): + shape_type: typing_extensions.Annotated[typing.Literal["square"], FieldMetadata(alias="shapeType")] + length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")] + + +ShapeParams = typing.Union[Shape_CircleParams, Shape_SquareParams] diff --git a/tests/utils/assets/models/square.py b/tests/utils/assets/models/square.py new file mode 100644 index 0000000..8fb83d7 --- /dev/null +++ b/tests/utils/assets/models/square.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +import typing_extensions +from vocode.core.serialization import FieldMetadata + + +class SquareParams(typing_extensions.TypedDict): + length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")] diff --git a/tests/utils/assets/models/undiscriminated_shape.py b/tests/utils/assets/models/undiscriminated_shape.py new file mode 100644 index 0000000..68876a2 --- /dev/null +++ b/tests/utils/assets/models/undiscriminated_shape.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing +from .circle import CircleParams +from .square import SquareParams + +UndiscriminatedShapeParams = typing.Union[CircleParams, SquareParams] diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py new file mode 100644 index 0000000..846cd35 --- /dev/null +++ b/tests/utils/test_http_client.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from vocode.core.http_client import get_request_body +from vocode.core.request_options import RequestOptions + + +def get_request_options() -> RequestOptions: + return {"additional_body_parameters": {"see you": "later"}} + + +def test_get_json_request_body() -> None: + json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) + assert json_body == {"hello": "world"} + assert data_body is None + + json_body_extras, data_body_extras = get_request_body( + json={"goodbye": "world"}, data=None, request_options=get_request_options(), omit=None + ) + + assert json_body_extras == {"goodbye": "world", "see you": "later"} + assert data_body_extras is None + + +def test_get_files_request_body() -> None: + json_body, data_body = get_request_body(json=None, data={"hello": "world"}, request_options=None, omit=None) + assert data_body == {"hello": "world"} + assert json_body is None + + json_body_extras, data_body_extras = get_request_body( + json=None, data={"goodbye": "world"}, request_options=get_request_options(), omit=None + ) + + assert data_body_extras == {"goodbye": "world", "see you": "later"} + assert json_body_extras is None + + +def test_get_none_request_body() -> None: + json_body, data_body = get_request_body(json=None, data=None, request_options=None, omit=None) + assert data_body is None + assert json_body is None + + json_body_extras, data_body_extras = get_request_body( + json=None, data=None, request_options=get_request_options(), omit=None + ) + + assert json_body_extras == {"see you": "later"} + assert data_body_extras is None + + +def test_get_empty_json_request_body() -> None: + unrelated_request_options: RequestOptions = {"max_retries": 3} + json_body, data_body = get_request_body(json=None, data=None, request_options=unrelated_request_options, omit=None) + assert json_body is None + assert data_body is None + + json_body_extras, data_body_extras = get_request_body( + json={}, data=None, request_options=unrelated_request_options, omit=None + ) + + assert json_body_extras is None + assert data_body_extras is None diff --git a/tests/utils/test_query_encoding.py b/tests/utils/test_query_encoding.py new file mode 100644 index 0000000..e68faf0 --- /dev/null +++ b/tests/utils/test_query_encoding.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + + +from vocode.core.query_encoder import encode_query + + +def test_query_encoding_deep_objects() -> None: + assert encode_query({"hello world": "hello world"}) == [("hello world", "hello world")] + assert encode_query({"hello_world": {"hello": "world"}}) == [("hello_world[hello]", "world")] + assert encode_query({"hello_world": {"hello": {"world": "today"}, "test": "this"}, "hi": "there"}) == [ + ("hello_world[hello][world]", "today"), + ("hello_world[test]", "this"), + ("hi", "there"), + ] + + +def test_query_encoding_deep_object_arrays() -> None: + assert encode_query({"objects": [{"key": "hello", "value": "world"}, {"key": "foo", "value": "bar"}]}) == [ + ("objects[key]", "hello"), + ("objects[value]", "world"), + ("objects[key]", "foo"), + ("objects[value]", "bar"), + ] + assert encode_query( + {"users": [{"name": "string", "tags": ["string"]}, {"name": "string2", "tags": ["string2", "string3"]}]} + ) == [ + ("users[name]", "string"), + ("users[tags]", "string"), + ("users[name]", "string2"), + ("users[tags]", "string2"), + ("users[tags]", "string3"), + ] + + +def test_encode_query_with_none() -> None: + encoded = encode_query(None) + assert encoded == None diff --git a/tests/utils/test_serialization.py b/tests/utils/test_serialization.py new file mode 100644 index 0000000..15bda20 --- /dev/null +++ b/tests/utils/test_serialization.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import List, Any + +from vocode.core.serialization import convert_and_respect_annotation_metadata +from .assets.models import ShapeParams, ObjectWithOptionalFieldParams + + +UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"} +UNION_TEST_CONVERTED = {"shapeType": "circle", "radiusMeasurement": 1.0, "id": "1"} + + +def test_convert_and_respect_annotation_metadata() -> None: + data: ObjectWithOptionalFieldParams = { + "string": "string", + "long_": 12345, + "bool_": True, + "literal": "lit_one", + "any": "any", + } + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams) + assert converted == {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"} + + +def test_convert_and_respect_annotation_metadata_in_list() -> None: + data: List[ObjectWithOptionalFieldParams] = [ + {"string": "string", "long_": 12345, "bool_": True, "literal": "lit_one", "any": "any"}, + {"string": "another string", "long_": 67890, "list_": [], "literal": "lit_one", "any": "any"}, + ] + converted = convert_and_respect_annotation_metadata(object_=data, annotation=List[ObjectWithOptionalFieldParams]) + + assert converted == [ + {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}, + {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"}, + ] + + +def test_convert_and_respect_annotation_metadata_in_nested_object() -> None: + data: ObjectWithOptionalFieldParams = { + "string": "string", + "long_": 12345, + "union": UNION_TEST, + "literal": "lit_one", + "any": "any", + } + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams) + + assert converted == { + "string": "string", + "long": 12345, + "union": UNION_TEST_CONVERTED, + "literal": "lit_one", + "any": "any", + } + + +def test_convert_and_respect_annotation_metadata_in_union() -> None: + converted = convert_and_respect_annotation_metadata(object_=UNION_TEST, annotation=ShapeParams) + + assert converted == UNION_TEST_CONVERTED + + +def test_convert_and_respect_annotation_metadata_with_empty_object() -> None: + data: Any = {} + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ShapeParams) + assert converted == data